Arduino Serial Writing Array Problem
you replace Serial.write(rb); to Serial.write(pack[ndx]); and get?:

char rb = Serial.read();
pack[ndx] = rb;
ndx++;
Serial.write(pack[ndx]);


then you read an uninitialized array item on the next index