fix the judgement of the list end