Fix handling of keystore creation