Fix file download logic.