Fix for OpenSSL error handling