reorganize token check