added check for internet access before trying to download