More tempfile fixes