fixing the keytype detection