Remove temporaries during scan (fixes #1092)