fixed bug for creating duplicate links