Be careful doing it as Martin suggests.
When gluing together midi parts like this there is a bug (or maybe a weird preference setting) where data from outside a visible parts boundaries ends up being erroneously included.
That may be difficult to understand so…
You have a take on lane 1, and a second take on lane 2.
You trim the beginning and end of the second take to just keep a few bars in the middle - but there is of course unwanted data still either side.
When you glue the parts together only the selected few bars of take 2 should be included, but often that outside data ends up in there as well.
You can get around this by making sure that you don’t trim parts, but cut them - that seems to work 100%