fixed some issues on quicksort