Fixing a problem with the key method