rm temp file and fix error