cleanup semaphore issue