Moved PKI_DIR definition to the script head