Fix num_parts calculation, close #10