fixed typo in while loop