Ensure TMPDIR is set before we use it. It *should* be, but sometimes under cron it is not, so double-check and add a default if the detection fails