Fix Semaphore creation and destroy old semaphores.