Merge changes I096b7c98,I1d7f46cc

* changes:
  Fixed nullptr deref when exporting a non existing key
  Fix deadlock in keystore