Fixing choosePivot routine in qsort