Fix foreach/repeat context