sort categories to bottom of non sparse texts and fix index error
Merge branch 'master' into pull_99