fix next match bug