Backport fix for NANs in mean curvature from v2.2