98 TJ Sahara was driving fine until all of a sudden at ~45 mph the truck started surging. Came to a stop and it threw a check engine light and started to idle extremely rough with a strong smell coming from the exhaust. Managed to limp it to an auto store and they read the check engine code as P0171. Managed somehow to make it back home a few miles away, but it wasn’t a pleasant drive. I have a spare O2 sensor since I didn’t know when the last time it was changed was and was planning on doing it, but wondering if there’s anything else I should look at, or if a bad sensor on a 98 would even cause this kind of behavior (specially the surging). Thoughts?