Fix qsort crash on 64-bit machines