fixes for keyId generation