fix a bug where templary file might be removed using Tempfile