Better handling of broken links & fixes for relative path generation