Fix handling of token in keychain