Fix bugs in sorting of extra vectors.