Changed some code for checking the certificates.