fix concurrency bug