change token API, use tid instead of index