fixed concurrency bugs