added check to make sure the result exists before applying forEach with a field array|object