The runaway problem sounds like the armature wires were reversed when you put it back together. But if the motor has a plug on it, that's almost impossible. The only other thing I can think of is that the encoders somehow got swapped between X and Y?