crash proofing

added do while loop