ENH: improve temp file