properly handle problems during server-side handshake