fixed to_tuples and unique