fix #6822 and remove temp file