Fix openssl related segfault and errors using https protocol