bug replace palette and undo