tls: fix handling of client and server init errors