fixed issue with semaphore and wait.h