using tempdir instead of tempfiles