Problems with INPUT_PULLUP

I cannot get yardButtonPin2 to work. it apparently stays HIGH even when its button is pushed the other two buttons work perfectly.

What should I be looking at to fix this.

Railway Yard-Siding Signalling V3.pdf (7.7 KB)

const int sidingButtonPin = 24;  
//number of the siding pushbutton pin 
const int yardButtonPin2 = 33;  
//number of the second yard pushbutton pin
const int yardButtonPin = 26; 
//number of first yard pushbutton pin

pinMode(sidingButtonPin, INPUT_PULLUP); 
 pinMode(yardButtonPin, INPUT_PULLUP);
 pinMode(yardButtonPin2, INPUT_PULLUP);

void loop() {
  // put your main code here, to run repeatedly:

  // check if the siding putton is pressed, if it is, it's LOW
  sidingButtonState = digitalRead(sidingButtonPin);

  // check if the yard putton is pressed, if it is, it's LOW
  yardButtonState = digitalRead(yardButtonPin);
  if (yardButtonState  == LOW) {
    Serial.print("First Yard Button Pressed");
  }
  if (yardButtonState == HIGH) {
    yardButtonState = digitalRead(YardButtonPin2);
    if (yardButtonState == LOW) {
      Serial.print("Second Yard Button Pressed");
    }
  }

  if (sidingButtonState == LOW) {
    //Serial.println("Siding Button Pushed");
    ThrowSidingSwitch();

  }

  if (yardButtonState == LOW) {

    Serial.println();
    Serial.println("Yard Button Pushed");
    ThrowYardSwitch();

  }

Posting your code.
Posting your schematic

Check the operation of the button by swapping it for another one. Does the problem follow the button or does it still occur on the same pin ?

I note that YardButtonPin2 is only read if YardButtonPin is currently HIGH. Is that what you intend to happen ?

Show us a good schematic of your circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.

Found the problem, I have a ground on the Mega that's not working. Moved it to another ground and now it working.