infinite loop bug was fixed