fix counting sort bug