concurrency bugs fixing