Replace a key