Fix #121: fix undo history when saving (autosave)