Fix for error 'XML declaration allowed only at the start of the document'