failed to change fixed variable to one controlled by loop index