Fixed race condition in socket.io which caused handshake errors