fixed bug with tmpdir