DetailComponent.ByCurve with multiple curves

I am trying to create a script that places line based detail components over railing families. It works on railings with a single segment but I get a null result if the railing has multiple segments. I tried combining them using CurveLoop.Simplicity but that still gave a null result.

… can you try Flatten

It seems to be that you not access the elements in the list.