array attribution and access, loop fix