Fixing download function.