Possibly loose or out of adjustment or defective. The cable to it also stretches over time and may need tightening.
Unfortunately, it may have been the cause of your o2 sensor code, because it signals the o2 sensors when the shift lever is in position D. If not adjusted properly then you may not be able to start your car without fishing around with the gear shift. It also affects your backup lights. The site below has info on it. It's the same as yours.
http://www.autozone.com/servlet/UiBroker?ForwardPage=/az/cds/en_us/0900823d/80/13/f4/46/0900823d8013f446.jsp#hd1-1-1#hd1-1-1