while loop bug fixed