fix autosave bug for DB