Handle edge cases when updating [link]s

Fixes #684