MDL-38147 changed logic for building list in make_categories_list()