Improved recoverFromMismatchedToken method.