i had the same issue. My AOS was bad, and i also had a kink in one of my boots, which was hidden underneath, and not visible. i also found that there was a hose that came loose below the resonance flap, and a screw had fallen out, which caused it not to work 100%. upon replacing AOS, all 4 boots and clamps, fixing the resonance tube and butterfly valve, and replacing the MAF the codes stayed away. I bought a smoke tester from a local guy who makes them in his garage. here is a link to my thread. i had the exact same codes p0171 & p0174
http://986forum.com/forums/diy-project-guides/43422-replacing-boots-intake-manifold-resonance-tube.html