fix crash if socket.handshake is null