added handling for bad ssl certs