diff --git a/src/signal/signal-cast-helper.cpp b/src/signal/signal-cast-helper.cpp
index 9b1323f45cc381dc2aff6414cb5e968669e757c5..633ab5f58fe09a8ee0f962a758e3424ab4bb3fb4 100644
--- a/src/signal/signal-cast-helper.cpp
+++ b/src/signal/signal-cast-helper.cpp
@@ -79,8 +79,7 @@ template <>
 inline boost::any DefaultCastRegisterer<std::string>::cast
 (std::istringstream &iss)
 {
-  std::string inst ("");
-  iss >> inst;
+  std::string inst (iss.str ());
   return inst;
 }
 
diff --git a/tests/signal-ptr.cpp b/tests/signal-ptr.cpp
index dfe54c9727bec8ca3bcbdae6b0e68d1dcb3804a7..a2fc5b5c67ff53b981b899898834b5b272b364a2 100644
--- a/tests/signal-ptr.cpp
+++ b/tests/signal-ptr.cpp
@@ -92,12 +92,21 @@ BOOST_AUTO_TEST_CASE (plug_signal_string)
   Signal<std::string, int> outSig("output");
   SignalPtr<std::string, int> inSig (NULL, "input");
 
-  std::string str ("value");
+  std::string str ("two words");
   outSig.setConstant(str);
   inSig.plug (&outSig);
   inSig.recompute(1);
-  std::ostringstream os;
-  inSig.get (os);
-  std::string res (os.str ());
+  std::ostringstream os1;
+  inSig.get (os1);
+  std::string res (os1.str ());
+  BOOST_CHECK (res == str);
+
+  Signal<std::string, int> s ("signal");
+  std::ostringstream os2;
+  s.setConstant (str);
+  os2.clear ();
+  s.get (os2);
+  res = os2.str ();
+  std::cout << "res=" << res << std::endl;
   BOOST_CHECK (res == str);
 }