make cycle detection on autosave works on a thread level