better idioms for tmpdir handling