initialize loop index