modify loop index