fixed a bug with lexicographic sort (integer underflow when pivot == left == 0)