Fixing bug caused by Magento passing XML elements directly before conversion to a string