fixed the undo and redo