for loop with bad results