Fix some bugs and improve multi thread performance by using task batch