fixed minor bug in semaphore.py