Fix the token middleware