Fix bugs causing memory corruption.
Download to single temp file.