Fixes for bug in rewriting XML content

It won't break the content anymore but it still doesn't rewrite urls appropriately