diff --git a/Common/onelab.h b/Common/onelab.h
index 80742674aa021056dfb26269db6fa1ab71b2b575..1165e9d6f09629c7f56472fd6c97f4d1a480839f 100644
--- a/Common/onelab.h
+++ b/Common/onelab.h
@@ -146,9 +146,9 @@ namespace onelab{
     {
       if(first == std::string::npos) return "";
       std::string::size_type last = msg.find_first_of(separator, first);
-      std::string next;
+      std::string next("");
       if(last == std::string::npos){
-        next = msg.substr(first);
+        next = msg.substr(first, last - first);
         first = last;
       }
       else if(first == last){