Fix incorrect sorting of routes