         case LMIC_CERT_RX_ACTION_END: {
             Serial.println(F("Exit test mode"));
             g_fTestMode = false;
-            do_send(&sendjob);
+            // we're in the LMIC, we don't want to send from here. Schedule a job.
+            os_setTimedCallback(&sendjob, os_getTime() + ms2osticks(10), do_send);
             return;
         }
         case LMIC_CERT_RX_ACTION_IGNORE: {


// Schedule TX every this many seconds (might become longer due to duty
// cycle limitations).
const unsigned TX_INTERVAL = 60;

// global flag for test mode.
bool g_fTestMode = false;

            break;

        case EV_TXCOMPLETE:
            Serial.print(F("EV_TXCOMPLETE: ch "));
            Serial.print(lastTxChannel);
            if (LMIC.txrxFlags & TXRX_ACK)
                Serial.print(F("; Received ack"));
            Serial.println(F("."));
            break;
        case EV_LOST_TSYNC:
            Serial.println(F("EV_LOST_TSYNC"));
