fix pipe write downloaded file