kx509 fix

Please review and merge.