invalid foreach when no categories are present