corrected a logout problem (new token written to database)