Fix issue with token checking