added some error handling for certs, https redirection