Fixed overflow on tasks when total number is small compared to the number of threads
Merge branch 'parallelize_cv'