Fix a concurrency bug.