Fixed error with socket handshake