improvements to temp file creation