fixed accidental clobber
fixed foreach bug
Merge pull request #1 from mikolalysenko/master

Fixed foreach bug, it now works with typed arrays.