fix tmpfile bug