fixed Undo/Redo functionality