fix token check