corrected keystore handling