NB-IoT only functioning with Serial Monitor

I’m using https://github.com/janvl1234/Sodaq_NBIoT_examples/tree/master/Sensors_NB-IoT/Sodaq_NB-IoT_All_Sensors ( a bit adapted to format the data better).
Temp, humidity, pressure and GPS received correctly and shown on AllThingsTalk correctly … but only if I connect the NB-IoT board + Leonardo to my laptop and start the Arduino IDE and the Serial Monitor. It looks like the program blocks if the Serial Monitor is not active. After it started delivering values to AllThingsTalk I am able to close the Serial Monitor and then it keeps sending values.
I suspect DEBUG_STREAM (= Serial). Anyone an idea what is happening with DEBUG.STREAM?
Is anyone using the device with only a power pack for example?

Franz

By adding a line in the #if defined (ARDUINO_AVR_LEONARDO) section:
bool Debug = false;
and changing all DEBUG_STREAM lines in the Sodaq_NB_IoT_All_Sensors.ino file to
if (Debug) DEBUG_STREAM.(etcetera)
the problem is solved and the NB_IoT device runs from a power pack.
But I still do not understand what the underlying cause is of this behavior: is it interference with MODEM_STREAM?
Help is appreciated.

Franz

Dear Franz,

This is the blocking code:

while ((!DEBUG_STREAM) || millis() < 10000) {
    		 // Wait for serial monitor for 10 seconds
    	 }

Remove the lines or update to:

while ((!DEBUG_STREAM) || (millis() < 10000)) {
		 // Wait for serial monitor for 10 seconds
	 }

Best regards,
Jan