null check for socket.handshake (which seems to be null sometimes...)