Properly detect save, fix double save bug