use tmpdir variable instead of hardcoding a path