fixed where/foreach so that they return the expected type; this fixes using multiple foreach/where statements in a single call in v3
update version