Fix bad SSL certificate handling issue