Fix bugs with undoing cut/paste