Index: /trunk/FACT++/src/InterpreterV8.cc
===================================================================
--- /trunk/FACT++/src/InterpreterV8.cc	(revision 18838)
+++ /trunk/FACT++/src/InterpreterV8.cc	(revision 18839)
@@ -377,7 +377,8 @@
     if (timeout)
         code +=       "var t = new Date();";
-    code +=           "while (1)"
+    code +=           "var s;"
+                      "while (1)"
                       "{"
-                         "var s = dim.state(name);"
+                         "s = dim.state(name);"
                          "if(!s)throw new Error('Waiting for state "+arg1+" of server "+arg0+" failed.');";
     if (isNot)
@@ -393,6 +394,6 @@
                       "}";
     if (timeout)
-        code +=    "if(ms>0)throw new Error('Waiting for state "+arg1+" of server "+arg0+" timed out.');";
-    code +=        "return false;"
+        code +=       "if(ms>0)throw new Error('Waiting for state "+arg1+" of server "+arg0+" ['+"+index+"+'] timed out.');";
+    code +=           "return false;"
                    "})('"+name+"',"+arg1;
     if (timeout)
