Avoid fatal error on activation hook if Keyring is not installed.

Also make connection check more robust.