bugfix, simplifying loop avoiding win=undefined
Merge pull request #1831 from sebv/ios-hybrid-bugfix

ios-hybrid bugfix