Added checking for corrupted JPEG image downloads. If JPEG image is corrupt the download results in an error.