So I bought a 99 Wrangler 6 cylinder auto a few months back. It was running fine for a month then one time after fueling her up the engine was acting funny, misfiring, revving erratically. I let it sit for a few minutes and it evened itself out. fast forward another month and the same thing happened again as I was about to get on the highway to go home from school. I did the same thing, it seemed better so off I went. Then about 25 miles later sh*t hit the fan. the engine started backfiring, misfiring, revving erratically all by itself even without my foot on the gas. a little while later the engine light came on. I managed to get it to my local mechanic and he started taking a look. he said it was throwing off a trouble code for the camshaft sensor. I had him replace it. then drove it home no problem. the next day I started it and tried heading to work, it acted up just like before and then stalled out. I managed to get it running again and brought it back to him. this time it gave the p01391 code which could be a number of things he said. he suggested replacing the crankshaft sensor which was supposedly the most common fix. I had him do it then once again drove it home no problem. 3 weeks later(I didn't drive it much during this, but still upwards of 50miles on one trip) it happened again with the same code p01391. this time he said he wasn't sure without blindly fixing things like the ECM, Distributer, or timing chain. I took it home and decided to replace the ecm myself. I did a test first where I disconnected the ecm and waited for its memory to clear then reconnected it. when the car turned over it was alright until I tried getting the engine above 3000rpm and it all happened again. I tried to code myself and it was p01391. so I replaced the ecm and it was running ok. I tried getting it above 3000 and it went but I thought I heard something and tried again, then it acted up again. not having the tools to do the distributer or chain myself I brought it to the mechanic again. I had him check everything before doing any replacing. he told me that he had it running and tried pulling on wires to see if one was broken and found nothing. he listened for a whine in the engine to suggest the chain and got nothing. he checked the calibration of the distributer and the sensors and found nothing wrong. we are both out of ideas. the only thing we also think is that the cold may have something to do with it, but we aren't sure. Please help.