     // risk of (amplification) loops due to a misconfiguration. We do increase the counter
     // so indirectly this does show up in the MQTT log.
     //
-    cnt_fails ++;
+    cnt_mqttfails ++;
     return;
   };
 

      char msg[256];
      snprintf(msg, sizeof(msg), "[%s] Tag <%s> (len=%d) swiped", pname, uidStr.c_str(), uid.size);
      client.publish(log_topic, msg);
    } else {
      Serial.println("Misread.");
      cnt_misreads++;


  static doorstate_t lastdoorstate = CLOSED;
  switch (doorstate) {
    case CHECKINGCARD:
      if (millis() - last_doorstatechange > 1500 && caching && checkCache(uid)) {
        char msg[255];
        snprintf(msg, sizeof(msg), "[%s] Allowing door to open based on cached information.", pname);
        Serial.println(msg);
        client.publish(log_topic, msg);
        openDoor();
      }
      break;
    case OPENING:
      if (isOpen()) {
        char msg[256];
        snprintf(msg, sizeof(msg), "[%s] Door is open.", pname);
        Serial.println(msg);
