Fixing thread issues.