fixed While loop