Fixed a bug in download()