have you tried to redo the railing? Looks like it is picking some rogue points. Cut a section near the stair and see if it gives you the same result in the 2d section. Man, I do not know where to begin other than checking the points. You might be able to attach it to the stair without having it choose the path for you, instead you can place the points yourself.