fixed init_keystore routine