fixed quicksort to handle when numbers are not distinct