fixed bug in qsort