Fixed a threading issue.