fixed quicksort, was trying to use pivot value when it needed the pivot index