04 Forester XT Check Engine Light

I have an 04 Subaru Forester XT, 78K. Twice, the check engine light came on with cruise light flashing. I took it into the dealer and the code referred to the gas cap. They checked the seal, no problem. They reset the computer both times and had no answer.

Two more times, the light combo appeared. These times, they went out a few days later. The car was always on the highway in cruise control when the lights came on.

In addition, occasionally when I fill the gas tank, I have trouble starting the car.

Any thoughts?