fix warning and add semaphore