modified semaphore