correct bug in link detection (was comparing to self)