fix download function

I fixed the main download function. Looks like a copy-paste error.