Fixed dirname generation for temporary files.