fixed a few bugs with foreach/where in PS 3.0