Fix typo in while loop