improved autosave functionality