fix semaphore initialization