fix for SSL connection infinite loop