Altima sometimes not changing gears...

Hi guys havin a problem here,just lost the motor in my 2003 Altima,lucky enough I had a spare car to swap out,I was using the car all time and it worked perfect 110,000 on the engine.After the swap the tranny seems to not wanna change at times.p0720,p1574 and p0502,I changed the vss drove a couple hundred kms and it happened again,seemed to be better than before but never the less its still there.Is there anything I missed during change over.Last night I received a p0507 code…Any ideas,maybe the TCM.Thanks