Fixed concurrency bugs