Index: /branches/network/src/lib/network/connection_monitor.cc
===================================================================
--- /branches/network/src/lib/network/connection_monitor.cc	(revision 7791)
+++ /branches/network/src/lib/network/connection_monitor.cc	(revision 7792)
@@ -81,6 +81,6 @@
     ackDelay.push_back( tick - sentStateTicks[ackedState] );
   }
-      
-  while ( sentStateTicks.begin()->first <= ackedState )
+  
+  while ( sentStateTicks.begin() != sentStateTicks.end() && sentStateTicks.begin()->first <= ackedState )
     sentStateTicks.erase( sentStateTicks.begin() );
       
Index: /branches/network/src/lib/network/handshake.cc
===================================================================
--- /branches/network/src/lib/network/handshake.cc	(revision 7791)
+++ /branches/network/src/lib/network/handshake.cc	(revision 7792)
@@ -41,5 +41,5 @@
   errorString_handler = registerVarId( new SynchronizeableString( &localState.errorString, &remoteState.errorString, "errorString", PERMISSION_ALL ) );
   
-  localState.completed = false;
+  localState.completed = 0;
   localState.error = 0;
   localState.errorString = "";
@@ -50,5 +50,5 @@
   localState.version = _ORXONOX_VERSION;
   
-  remoteState.completed = false;
+  remoteState.completed = 0;
   remoteState.error = 0;
   remoteState.errorString = "";
@@ -76,10 +76,9 @@
       {
         localState.error = 1;
-        localState.completed = true;
+        localState.completed = 1;
         localState.errorString = "Seems not to be orxonox!";
-        return;
+        continue;
       }
-      else
-        localState.completed = true;
+
     }
      
@@ -89,13 +88,18 @@
       {
         localState.error = 2;
-        localState.completed = true;
+        localState.completed = 1;
         localState.errorString = "Versions of server and client do not match!";
-        return;
+        continue;
       }
-      else
-        localState.completed = true;
+
     }
     
   }
+  
+  if (
+      remoteState.orxId == _ORXONOX_ID &&
+      remoteState.version == _ORXONOX_VERSION
+     )
+    localState.completed = true;
 }
 
Index: /branches/network/src/lib/network/network_stream.cc
===================================================================
--- /branches/network/src/lib/network/network_stream.cc	(revision 7791)
+++ /branches/network/src/lib/network/network_stream.cc	(revision 7792)
@@ -196,6 +196,7 @@
   cleanUpOldSyncList();
   handleHandshakes();
+  
+  handleDownstream();
   handleUpstream();
-  handleDownstream();
 
 }
@@ -250,12 +251,13 @@
   }
 
-
   //check if connections are ok else remove them
   for ( PeerList::iterator it = peers.begin(); it != peers.end(); it++ )
   {
-    //TODO check for timeout
     if (  
-          (it->second.socket && !it->second.socket->isOk() ) ||
-          it->second.connectionMonitor->hasTimedOut()
+          it->second.socket &&
+          ( 
+            !it->second.socket->isOk()  ||
+            it->second.connectionMonitor->hasTimedOut()
+          )
        )
     {
@@ -337,4 +339,6 @@
             MessageManager::getInstance()->setUniqueID( it->second.handshake->getMessageManagerId() );
           }
+          else
+            handleNewClient( it->second.userId );
 
           PRINT(0)("handshake finished id=%d\n", it->second.handshake->getNetworkGameManagerId());
@@ -342,6 +346,5 @@
           delete it->second.handshake;
           it->second.handshake = NULL;
-          
-          handleNewClient( it->second.userId );
+
         }
         else
@@ -504,4 +507,5 @@
         if ( sync == NULL )
         {
+          PRINTF(0)("could not find sync with id %d. try to create it\n", uniqueId);
           if ( oldSynchronizeables.find( uniqueId ) != oldSynchronizeables.end() )
           {
@@ -524,9 +528,11 @@
 
           Converter::byteArrayToInt( buf + offset, &leafClassId );
+          
+          assert( leafClassId != 0 );
         
-          BaseObject * b;
+          BaseObject * b = NULL;
           /* These are some small exeptions in creation: Not all objects can/should be created via Factory */
           /* Exception 1: NullParent */
-          if( leafClassId == CL_NULL_PARENT || leafClassId == CL_SYNCHRONIZEABLE )
+          if( leafClassId == CL_NULL_PARENT || leafClassId == CL_SYNCHRONIZEABLE || leafClassId == CL_NETWORK_GAME_MANAGER )
           {
             PRINTF(1)("Can not create Class with ID %x!\n", (int)leafClassId);
@@ -573,4 +579,5 @@
     
       peer->second.lastAckedState = ackedState;
+      
       peer->second.lastRecvedState = state;
       
