Fix minor bugs in download script.