replacing all vec_sort() invocations to vec_sort_with_function()