fix endless loop with duplicate sections

fix #191