Fixed TLS bug as pointed out by fluffy