BRepOffsetAPI_MakePipeShell bspline error

Hello everyone, I do not know if you have encountered this situation?

BRepOffsetAPI_MakePipeShell from a spine of bsplinecurve and a profile of circle, but strange results appeared. See Figure 1 and Figure 2 specifically.

I don't know how to eliminate this problem. In addition, but if the spine is a line or arc or circle or ellipse, it's ok.

The code I created is as follows.

Thank you all.