     int channelNumber;
     if ( server.hasArg( "channel" ) ) {
       channelNumber = server.arg( "channel" ).toInt();
-      if ( channelNumber < 0 || channelNumber > NUMBER_OF_CHANNELS ) {
+      if ( channelNumber < 0 || channelNumber >= NUMBER_OF_CHANNELS ) {
         server.send( 400, textplainHEADER, "Invalid channel." );
         return;
       }

  while (1)
  {
    server.handleClient();
    vTaskDelay( 1 / portTICK_PERIOD_MS);
  }
}


    if ( server.hasArg( "channel" ) ) {
      channelNumber = server.arg( "channel" ).toInt();
      Serial.println(channelNumber);
      if ( channelNumber < 0 || channelNumber >= NUMBER_OF_CHANNELS ) {
        server.send( 400,  textplainHEADER, "Invalid channel." );
        return;
      }
