Better TLS handling