rm temp file and fix error(2)