flatten_categories now works for objects