replace engine and tranny out of a car that was upside down engine works great but tranny not shifting right ?is it the sensors?could it be dirt from being upside down ? where should i start? thanks

ok sorry guys It's an automatic when i first start car put it in drive it works fine 1st 2nd 3rd od when i stop and start again if i put it in drive i start in drive no 1 2 3 or od i can put it in 1st it works if i then shift manually but but no lower gears if i start in drive