Fix to the profiler error when use threads.