Bugfix in 'for' array loops