Fix comparison of records whose attributes are in diff orders

Order the attributes prior to comparison