sort categories to bottom of non sparse texts and fix index error