fix bug whereby the key would disappear when it shouldn't