Fix the work cannot count to miner thread, some cleanup