rebuild for forEach function