How to fix this stairs script for curves

I am using this stair script

but I have a problem with some of the curves in my Rhino model. Once I use these curves the stairs would snap sometimes on the left and sometimes on the right. I programmed it to be on the right so I don’t understand what is going wrong.

Help Us Help You - Grasshopper - McNeel Forum