Usually an o2 sensor isn't the problem with a p0171 as from what I read from Bill on this forum