Added handling of download failure