Properly handle removing and adding a key in the same command.