The last global was factored out. What a mess. Lesson learned: Avoid globals in OpenSCAD.