trying to fix semaphore