Added tmp_dir support