Some tweaks for TLS support