Fixed a typo in the while loop