emissions test failed on 1997 Nissan Pickup (D21)

I failed the emissions test...They said it was the rear o2 sensor...I just put a new one in and reset the check engine light...It came back on...Any one know what else it could be..... p0141 is the code

2 answers
Can you please provide the code that is stored?
Ensure the wires/wiring harness to the oxygen sensor are not burned or melted due to contact with the exhaust manifold.
The two black wires to the oxygen sensor are the ones that control the heater circuit of the O2 Sensor. Ignition key on one of those two wires should have 12 volts the other gets grounded through the fuel injection computer.