Fix file corruption on download