fixed a bug with undo/redo