change partition number from (nr_threads + 1) to nr_threads