Fix bugs in undo/redo.  Appears to work now but not heavily tested.