Fixed the for loop