Fix serveral bugs, like:

* Wrong elapsed time.
* Crashes.
* Expired token.