fixed bugs on ssl/tls reading handshake messages