bugfixes in keychain derivation