Edit index in foreach