Added the `maxOrder` argument in this file. When connecting a relation at the end, it looks at this value instead of the last relation of the array.    The case you presented would be fixed, but not the one where you have relations: 5,1, 10  And you do `connect: [{id: 1, before: 1}]`.   This throws an exception now, which I think is the correct behaviour. Still, I wanted to point it out.