fix undo/redo problem