Added a bit more fault tolerance to token retrieval