Clean up double-and-add loop.

I was cleaning out an old disk and found this change from ages back.

I tried to test it by installing the unpacked extension and checking that I can communicate with an unmodified extension. However, I don't know whether that actually exercises this code :(