Various quicksort fixes