Fix broken reference

ordered_fields was being assigned in a conditional block but used in all code paths.