I don't know how to fix that off hand but I'm wondering why you are not getting the section shape from Family.StructuralSectionShape? A library of families that implements this has standardised parameters and so is easier to identify dimensions of the section as well as the shape.
Almost certain this feature of the REX framework is not covering all the section shapes that exist.