Ticket #609 - adding extra sanity checks around key storage/retrevial