Moved setting the thread local to where TaskContext is instantiated.