fix bug with inversion of tuples
fix bug with inversion of tuples