Fixing x509 code