added checking for download failure