Fix a bug affecting key changes, caused by d01af7f8857383bcd257e34766d786f057bd0484