Fixed threading issue.