[Bug 978002] Don't create duplicate links.

Apparently trying to create a duplicate link has been causing replication to stop on the database servers, because it caused errors. I also fix some lint errors. 

r?