change the declaration order of variables, Tree AutoSave now occurs every 10000 events