fixed bug that would result in foreach not working on a scope