download script changed

now file extension is decided dynamically