Fix bug in saving 'token' from config

(added test only reproduces bug in non-mocked)