diff --git a/src/common/Session.cpp b/src/common/Session.cpp
index 47364076f6cd126180961c10742cb7662f788549..c42130970c86838db144eebaa3deab75596f85ec 100644
--- a/src/common/Session.cpp
+++ b/src/common/Session.cpp
@@ -286,16 +286,18 @@ void Session::get_palettes_name(const std::string &type, QStringList &list) {
 }
 
 Palette *Session::get_palette(const std::string &type, const std::string &palette_name) {
-    Palette *p = NULL;
-
+    Palette *p, **where_from;
     if( type == "palette" ) {
         p = _palettes_state;
+        where_from = &_palettes_state;
     }
     else if( type == "link_types" ) {
         p = _palettes_link;
+        where_from = &_palettes_link;
     }
     else if( type == "event_types" ) {
         p = _palettes_event;
+        where_from = &_palettes_event;
     }
 
     if(!p || p->get_name() != palette_name) {
@@ -304,6 +306,7 @@ Palette *Session::get_palette(const std::string &type, const std::string &palett
         QMap <QString, QVariant> qmap = S->value(QString::fromStdString(type+"/"+palette_name+"/map")).toMap();
 
         p = new Palette(string(type+"/"+palette_name));
+        *where_from = p;
         for(QMap<QString, QVariant>::const_iterator it = qmap.constBegin() ;
             it != qmap.constEnd() ; ++ it) {
             const QColor qc = it.value().value<QColor>();
diff --git a/src/common/Tools.cpp b/src/common/Tools.cpp
index a2c399ca1768bc376b264d39a7f6ec93c73ef4ba..3b5537acb7a79d8ba6ce1d05227c7e2b24a3593e 100644
--- a/src/common/Tools.cpp
+++ b/src/common/Tools.cpp
@@ -59,7 +59,7 @@ using namespace std;
 bool convert_to_double(const std::string &arg, double *val) {
     unsigned int nb_read;
     // Try to convert first in the current locale
-    sscanf(arg.c_str(), "%lf%u", val, &nb_read);
+    sscanf(arg.c_str(), "%lf%n", val, &nb_read);
 
     if(nb_read == arg.size()) {
         return true; // It is the good format
@@ -88,7 +88,7 @@ bool convert_to_double(const std::string &arg, double *val) {
         }
 
         // Reads the value in the new locale
-        sscanf(arg.c_str(), "%lf%u", val, &nb_read);
+        sscanf(arg.c_str(), "%lf%n", val, &nb_read);
         return nb_read == arg.size();
     }
 }