correct handling of temp filenames