bug fix in token testing