bug fix for printing out top row in for loop