need to create tmpdir first