Fixing bug related to SamplerThread