added fallback flattening of category ids