Index: /trunk/FACT++/src/InterpreterV8.cc
===================================================================
--- /trunk/FACT++/src/InterpreterV8.cc	(revision 14539)
+++ /trunk/FACT++/src/InterpreterV8.cc	(revision 14540)
@@ -222,11 +222,15 @@
     const String::Utf8Value str(args[0]);
 
-    const pair<int32_t, string> rc = JsState(*str);
+    const State rc = JsState(*str);
+
+    //if (rc.first<=-256)
+    //    return Undefined();
 
     Handle<ObjectTemplate> obj = ObjectTemplate::New();
 
-    obj->Set(String::New("index"), rc.first<=-256?Undefined():Integer::New(rc.first),         ReadOnly);
-    obj->Set(String::New("name"),  rc.first<=-256?Undefined():String::New(rc.second.c_str()), ReadOnly);
-    //obj->Set(String::New("toString"),  String::New(("[Object state "+string(*str)+"]").c_str()), ReadOnly);
+    obj->Set(String::New("index"), rc.index<=-256?Undefined():Integer::New(rc.index),       ReadOnly);
+    obj->Set(String::New("name"),  rc.index<=-256?Undefined():String::New(rc.name.c_str()), ReadOnly);
+    obj->Set(String::New("time"),  Date::New(rc.time.JavaDate()),                           ReadOnly);
+    //obj->Set(String::New("toString"),  String::New(("[Object state "+string(*str)+":"+to_string(rc.index)+"]").c_str()));
 
     return handle_scope.Close(obj->NewInstance());
@@ -588,5 +592,6 @@
     ret->Set(String::New("counter"), Integer::New(p.first), ReadOnly);
     ret->Set(String::New("time"),    Date::New(evt->GetJavaDate()), ReadOnly);
-    ret->Set(String::New("qos"),     Integer::New(evt->GetQoS()), ReadOnly);
+    ret->Set(String::New("qos"),     Integer::New(evt->GetQoS()),   ReadOnly);
+    ret->Set(String::New("size"),    Integer::New(evt->GetSize()),  ReadOnly);
 
     typedef boost::char_separator<char> separator;
@@ -603,4 +608,7 @@
         for (auto it=tok.begin(); it!=tok.end(); it++, pos++)
         {
+            if (ptr>=evt->GetText())
+                return handle_scope.Close(ret);
+
             char type = (*it)[0];
             it++;
Index: /trunk/FACT++/src/InterpreterV8.h
===================================================================
--- /trunk/FACT++/src/InterpreterV8.h	(revision 14539)
+++ /trunk/FACT++/src/InterpreterV8.h	(revision 14540)
@@ -10,4 +10,5 @@
 #endif
 
+#include "State.h"
 #include "Description.h"
 #include "EventImp.h"
@@ -94,5 +95,5 @@
     virtual void  JsSleep(uint32_t) { }
     virtual int   JsWait(const std::string &, int32_t, uint32_t) { return -1; };
-    virtual std::pair<int32_t, std::string>  JsState(const std::string &) { return std::make_pair(-256, ""); };
+    virtual State JsState(const std::string &) { return State(); };
     virtual void *JsSubscribe(const std::string &) { return 0; };
     virtual bool  JsUnsubscribe(const std::string &) { return false; };
Index: /trunk/FACT++/src/RemoteControl.h
===================================================================
--- /trunk/FACT++/src/RemoteControl.h	(revision 14539)
+++ /trunk/FACT++/src/RemoteControl.h	(revision 14540)
@@ -170,7 +170,7 @@
     virtual void  JsException(const std::string &str) { if (fImp) fImp->Error(str.empty()?" ":str); }
 
-    pair<int32_t, string> JsState(const std::string &server)
-    {
-        return fImp ? fImp->GetServerState(server) : make_pair(-256, string());
+    State JsState(const std::string &server)
+    {
+        return fImp ? fImp->GetServerState(server) : State(-256, string());
     }
 
@@ -208,8 +208,8 @@
 
         int rc = 0;
-        while (timeout>Time() && !T::IsScriptStopped())
-        {
-            const pair<int32_t, string> st = fImp->GetServerState(server);
-            if (st.first==-256)
+        do
+        {
+            State st = fImp->GetServerState(server);
+            if (st.index==-256)
             {
                 lout << kRed << "Server '" << server << "' disconnected." << endl;
@@ -217,5 +217,5 @@
                 return -1;
             }
-            if (st.first==state)
+            if (st.index==state)
             {
                 rc = 1;
@@ -225,4 +225,6 @@
             usleep(1);
         }
+        while (timeout>Time() && !T::IsScriptStopped());
+
         T::Unlock();
 
