Improved unification to deal with non-linear indices