Fix error message and return code on failed downloads

Closes #1700; thanks for reporting !