Fixing bugs and add test file for CounterQue thread version