Limit concurrency with a semaphore

This fix may resolve #9.