Fixed a concurrency related issue