loop on entities and errorentities