Failed smog test fuel tank not holding vacum

I hate to be the one to break this to you, but it's not clear to me..........did you replace the beat-up filler end where the cap fits? That alone could account for poor sealing and failure of the test. I hope you know you must have the proper fuel cap, known as a "pressure vacuum" cap.