fixed bug in temp-file naming