Closest point for given point sorting loop

This is exactly what I was looking for…however…

Using Revit 2022/ Dynamo 2.12, the Design Script for sorting points by proximity fails - returns the first point and the rest are nulls.
Working in Revit 2020 (whatever Dynamo version that is) it works completely fine.

With my limited knowledge of scripting, the logic seems fine, so I’m assuming this is due to a change in Design Script interpretation, but I could not figure it out. Any hints on what has changed?