less bug and more semaphore