fixed bug when connecting with mismatched handshake