Added error quitting if handshake failed