fix out of order objects from returning its fields in the wrong order

don't rely on the order of keys in the object. Instead, use the first object field order