Santa fe 2.4l hesitation on acceleration and rpm changes while cruising

I have a 04 santa fe 2.4L 4cyl. I recently did an engine swap, old motor threw a connecting rod. I put my intake, exhaust manifold and head on it. Timed it. All new gaskets. Turn the key and it fires right up and runs great. But when you accelerate it sounds loud (almost diesel like) and doesnt shift at the right time, also while trying to cruise it will drop about 300 rpms and then come back up, then back down and up every 3 to 5 seconds. The transmission was fine when the old motor came out. The head/intake were fine also. All the vacuum lines are connected, cant hear a vacuum leak anywhere. But it keeps throwing a throttle body sensor code and it wasnt broken when the old motor went, i even swapped another used one on it and it still throws that code. Im thinking it has to be intake related. What are your guys thoughts im at my wits end with this and i really need the car back functional. Thanks for any reponses.

You may have an exhaust restriction due to debris in the exhaust system from the failed engine. “Throttle body sensor code” is rather vague, if you had a throttle position sensor performance fault it may may be because the MAP sensor input value doesn’t correlate with the TPS value. You need to follow the diagnostic procedure for the fault you have.

I would go over my work. Be sure that no vacuum lines got pinched between parts that you were installing. It would not be
the first time something like this has happened as a lot of things are hanging in the way while you do much of this work.

Also a wire may have been stressed somewhere that is not making contact. If you remember any wires that you had difficulty unplugging, that may be where the problem lies.

I would also crawl under and make sure everything is plugged into the transmission.

Don’t feel bad it’s easy to miss a plug or vacuum line.

Yosemite

Hard to say given all what’s been done with this engine. hmm … I think what I’d do first is use some starter fluid spray or propane to rule out a yet unfound air leak into the intake manifold. Test especially around the throttle body area, intake manifold, and head gasket. If the rpms increase at a certain spot, that’s where the leak is occurring.

The only other thing I can add, one time I had a problem like this, turned out to be with the throttle body on my Corolla after I’d made some custom changes to correct for a failing gadget that – if it worked – increased the idle speed when the engine was cold. My modifications apparenlty weren’t air tight and that was allowing a variable amount of air into the intake manifold via that pathway, causing a surging effect where the rpms would increase, then decrease for no reason. My Corolla is a manual trans so no trans involvement, but I could see where that would confuse an automatic trans to no end.

Thanks guys for the responses, my next days off ill try and look at all of what u guys said. I have a feeling it is something dumb im just not finding since it is running so well at idle and revs nice. Whatever is not right or leaking is cauing the driveablity problems.