Restored TLS workarounds - apparently still necessary