undefined token warning, check token before using