there is a bug in:
for (int q=0; q < 3; q++) {
for (int i=0; i < NUM_LEDS; i=i+3) {
int pos = i+q;
leds[pos] = c;
if NUM_LEDS is 50 you end up in 48 + 2 = 50 for i = 48 q = 2
which writes to an position outside the array or cause an exception
you better check for (i+q) < NUM_LEDS
this limitation / bug is inherried from examples