Check and fix wrong x509 version field.

This fixes #11653.
the major bit of this fix is on this simple line :)