Updated #67 (different types of semaphore type causes bug)