key storage fixes