Commenting Serial.println line change behaviour

If commenting out some Serial.print() statements in that snippet of code causes problems, then, the problem is not in that snippet of code.

This is an atrocity:

    //Serial.println(String("---------------------------------"));

Wrapping a char array in a String so that the println() method has to unwrap it is a complete waste of time and resources.

I'm willing to bet that that is not the only code like that in your sketch.