fixed a bug in for loop that prevented setting array names.
Merge branch 'hotfix/duplicatebug'