added token type check