Fixed a concurrency issue