fix some bugs, now imgsPerThread can be any number
fix some bugs, now imgsPerThread can be any number