Type cast as an array in foreach, fixes #82
Merge pull request #83 from x-team/issue-82

Type cast as an array in foreach, fixes #82