resolved a bug: sp.unique returns type np.ndarray, of which the first entry is of type dict_values, but new_order.values() returns type dict_values - broke when comparing lenghts, so select first entry so that two dict_values are compared