Fix NaN problems with counts