Fix Undo bug.