Fixed a concurrency bug