config: declare i outside for loop