Fixed threading stuff.