check stopWaitingForToken is a function