Create Spiral stairs using Revit API/Python

Dear All,
I have been trying to create a spiral Stair using the code below. I am feeding in the data as coordinates by using a json file. Even though the drawing created from the data looks correct I am still getting an error message: Cannot finish run sketch. Run sketch cannot have a riser segment intersecting the boundary at more than 2 points.
Any ideas what is going wrong?

Think we will need your python code, pasted as preformatted text to troubleshoot this one.

 #define lists
RiserCrv= List[Curve]()
BoundaryCrv= List[Curve]()
PathCrv= List[Curve]()

#Start Transaction
Levels=Fec.OfClass(Level).ToElements()
for level in Levels:
    if level.Name=="LevelBottom":
        LevelBottom=level
        BotId=level.Id
    if level.Name=="LevelTop":
        TopId=level.Id

newStairsScope = StairsEditScope(doc, "New Stairs")
newStairsId = newStairsScope.Start(BotId,TopId)
tx = Transaction(doc, 'Stairs')
tx.Start()

class StairsFailurePreprocessor( IFailuresPreprocessor ):
    def PreprocessFailures(self,failuresAccessor):
        return FailureProcessingResult.Continue

# RiserCrv_Create Linesfrom points
for key,values in RiserCrv_1_json:
    ln=Line.CreateBound(dXYZ(values[0]),dXYZ(values[1]))
    RiserCrv_1.Add(ln)

#create plane from basepoint
Planes_Outer=Plane.CreateByNormalAndOrigin(XYZ(0,0,1),BoundaryCrv_Outer_BP)
Planes_Inner=Plane.CreateByNormalAndOrigin(XYZ(0,0,1),BoundaryCrv_Inner_BP)
Planes_Path=Plane.CreateByNormalAndOrigin(XYZ(0,0,1),PathCrv_BP)

#BoundaryCrv_ Create Arc by points
BoundaryCrv.Add(Arc.Create(Planes_Outer,m2f(BoundaryCrv_Outer_radius),startangle,endangle))
BoundaryCrv.Add(Arc.Create(Planes_Inner,m2f(BoundaryCrv_Inner_radius),startangle,endangle))

#Create PathCrv
PathCrv.Add(Arc.Create(Planes_Path,m2f(PathCrv_radius),startangle,endangle))

#CreateSketchedRun
Stair_1 = Architecture.StairsRun.CreateSketchedRun(doc,newStairsId, LevelBottom.Elevation, BoundaryCrv, RiserCrv, PathCrv)

#End Transaction
tx.Commit()
newStairsScope.Commit(StairsFailurePreprocessor())