Fixed potential issue when generating sitemap XML file (#556)