change each to have the same behaviour between array and object store