bug fix in handshake function