Check engine light

i have a 2001 ford taurus. just changed the engine with a used engine has 130k, did tuneup changing all spark plugs, wires and distributor cap. also changed the 02 sensor upstream. and the check engine light remains on. if i start the car and it idles the check engine light flashes. but once i drive it, it just remains on. brought to the mechanic and he put on the machine and it reads that the problem is the 02 sensor upstream and the spark plugs misfiring. my mechanic is lost not sure what the problem is. someone told me it could be the manifold gaskets and pedlum gasket. not sure any ideas please help.

Your best bet would be to take it to a ford dealer for diagnosis. We ha a similar problem on an 03 Ford, bad plenum o rings.