bug fixes in keystore