the if-case is taken only one time in the while-loop, why?