quick sort bug fix