By putting the (horizontal) parts back together within the fenced-in passage you have already begun to fit the pieces back together. But once you are satisfied that the problem has been fixed, you need to place the small fenced-in passage back into its LARGER CONTEXT, such as the phrase or staff system.
You can accomplish this by practicing several repetitions of the larger section at a slower tempo, and then working towards several repetitions at a slightly faster tempo. Repeat this process until reaching proficiency at a designated tempo.
If the old problem reappears, back up and slow down your progress through the steps to allow perfect repetitions.