some rework on sync.h