add exception handling for download()