Fix a bug in qsort

Try `qsort [3,3]`. Under the old code, you'd get `[3,3,3]` out.