More edge case handling, rewrite relative links