fix concurrency bug.