Fix in loop to insert if into for.