fix bug in Each code generation