Fix resolve section order based on better understanding of ensure_section_order