TLS connection fixes