Solved undo/redo bug