Modify to create tmp directory if it dows not exists at the time  parameters.json is created.
Merget fix/create-tmp-dir-if-not-exists.