trying to fix a do while loop