Fixes undo/redo behavior so that a whole transaction is re/undone or nothing is done