small code fix in key registration