Fixed small for loop issue