patch for bug with tempfile/tmpdir