fix test : the condition in the while loop is not right.