Turning Mesh into Nurb Surface - something going wrong

I’m using a script that turns a mesh into a continuous NURB surface by finding the intersecting points along the original mesh from a grid of control points, constructing NURB curves with those control points and then lofting them into a surface. However, the edges refuse to intersect, even though I projected the divided control points (bottom most red control points) along the z vector which should theoretically just be perpendicular.

You can see in the script panel that there are unidentified values which are the missing edge control points. Not sure the reason for this and an easy fix?

The full script is from (32) Convert Site Mesh into a Single Continuous NURBS Surface | Rhino Mesh to NURBS | Rhino Site Model - YouTube

Thanks

The video is about using Grasshopper, not a Rhino script. I’ve changed the category to Grasshopper.

For hints about how to make it more likely someone will help you see