Token expiration time and some other minor bugfixes