add foreach pattern, but not work