sort categories by rank