bug fix: loop index vs. item