modify the undo redo method