fixed compiler errors in semaphore