Fixed undo/redo bug and a __getstate__ bug in domain.py