I'm surprised no one has questions the electronics in the engine.
Is this engine a PS2 or PS3 engine? If so, these are not compatible with your transformer hence the spotty operation.
Best is to use an MTH Z-1000. More power, less $, will run just about anything under the sun. Lionel CW transformers are NOT recommended by MTH.