Finally and for real fixed uri precedence sorting.