 boolean downloadWaiting = false;
 char* cacheFilename = "TMP";
 unsigned long content_length = 0;
+boolean statusOk = false;
 
 void checkForDownload() {
   unsigned long length = 0;
   content_length = 0;
+  statusOk = false;
   if (SD.exists(cacheFilename)) {
     if (SD.remove(cacheFilename)) {
       debug("Cleared cache");

    // Close the connection, and flush any unwritten bytes to the cache.
    client.stop();
    cache.seek(0);
    boolean success = (content_length == length) && (content_length == cache.size());
#ifdef DEBUG
    if (!success) {
      debug2("Failure, content length was ", content_length);

      debug("Still connected");
      while(client.available()) {
        if (parsingHeader) {
          client.find("HTTP/1.1 ");
          char statusCode[4];
          client.readBytes(statusCode, 3);
          statusOk = (strcmp(statusCode, "200") == 0);
          client.find("Content-Length: ");
          char c;
          while (isdigit(c = client.read())) {
