Fix bug with autosaving