revise foreach