Fixed threading issues from last version.