Fix the management of the sorting