Fixed a bug which could cause infinite recursion when obtaining a token