corrected c++03 for loop