prevent segfault when tmp_dir is not provided.