minor tweaks in download_file function