Fixed Undo+Redo bugs