bugfix: modified state is reset even when saving fails + more tests

(0) -10 -1 +1 tip

mercurial