added error checks for download