Fix bug caused by invalid token