Fixed a possible concurrency issue.