fix the array overflow in counting sort