issue for loop bug