2.3 g/s at idle is a little low, Nissan MAF's tend to read a bit more than the engine displacement in g/s at idle. For a 2.4L I'd expect to see a reading more like 2.8~3.0 g/s. That would jive with the usual cause for a P0171, which is a vacuum leak, not the MAF. Stream your STFT (Short Term Fuel Trim) with your scanner. If it goes very high at idle but drops to near +0% at 2K RPM or more, you have a vacuum leak.