for loop layout correction