[build] check token validity: improvement