fixed bug for NOT RUNNING behavior in semaphore