I just fixed the same problem on my 996! The fuel lid was not locking. I was able to observe the locking pin extend and retract bit it did not lock. The pin was wobbly in the opening, meaning it was just floating in a large opening from the body. I could see that if something were to direct the pin in the proper direction it would work.
I searched Pelican Parts and discovered a guide bushing for $1.50
I simply snapped it in place and the locking pin now locks! A very easy fix indeed.