fix the loop of for

loop was wrong