Fixes for the semaphore