Fixed issue when trying to delete links

[target] was being checked if set rather than [$target].