more robust tmpdir creation