Please explain why Pin13 and Serial.write misbehaving

Except for that last line yes as the last line instantiates and instance with an array length of 12 named 'debug' - place that in an implementation file where used. Adjust array length as necessary.