turn no longer ends on bad input

one complicated while condition