stuck in while loop fixed