Implement for loop + fix address computation bug