fixed sem_post in time_lag messy code