fix loop over array

Jira-issue: WP-1246