The thoughts that the top of the wall are live-ball area are wrong. Think of it this way, the dimensions to the wall (the face of the wall) are what is measured and marked on the signs. The boundary is the FACE of the wall and extends upwards. If the ball hits the TOP of the wall it has left live-ball area, contacted something and then, even if it returns to the field of play is a dead ball. Since it left the field of play between the foul poles and before it hit the ground, it is a HR. Whether it hits a pole, or a railing or anything else doesn't matter once it hits the top of the wall/fence. It is already dead.