Fix some null exceptions in keyboard setup

Also handle random DBus exception thrown by Linux Mint 17/Cinnamon.
This fixes https://jira.sil.org/browse/WS-284.