Fixes and improvements to relative link fixing