Fix a bug in downloader caused by refactoring