diff --git a/lib/client.c b/lib/client.c
index 3c8986cdaf9ebc394675f3fde6c949f7e252636a..bf7ce5533ef301375c174f1f3a0df55376da5f17 100755
--- a/lib/client.c
+++ b/lib/client.c
@@ -355,9 +355,10 @@ start_ws_hanshake:
 #ifdef LWS_OPENSSL_SUPPORT
 		/* we can retry this... just cook the SSL BIO the first time */
 
-		if (wsi->use_ssl && !wsi->ssl) {
-			if (lws_ssl_client_bio_create(wsi))
-				return -1;
+		if (wsi->use_ssl && !wsi->ssl &&
+		    lws_ssl_client_bio_create(wsi) < 0) {
+			cce = "bio_create failed";
+			goto bail3;
 		}
 
 		if (wsi->use_ssl) {