Fix so number of cores is min(numRep, coresAvail)