Corrections to error handling around server certificate.