Fixed some SSL handshaking and connection reuse issues