Fix problem with tracking undo/redo