BUG: temp files were not created properly