Fix potential sort_by aliasing problem.