Now the data temp directory is the same as the script directory was, but they both do not seem to exist at the same time. I'll try to find out why the data file is gone when the script file is ready to be used.
Also, another bug: $baseTmp construction varies with $ENV(TMP) having priority over $ENV(TEMP) and vice versa elsewhere.