Do not crash when asked to export private keys

fix #852