Merge pull request #5397 from MerryMage/do-not-cast-derived-to-base Config/Layer: Fix accidental cast of RecursiveSection to Section