Improve temp file creation