for loop fixes