fixed a threading issue.