core: improve ForEach methods