improve link/unlink operation, safe check on existence of target docs