Fixing bug which causes empty element when ampersand is used

Due to design flaw in SimpleXML, ampersands will not be escape when using addChild. You end up with an empty element and you get this error:

`Warning: SimpleXMLElement::addChild(): unterminated entity reference`

It's discussed in the PHP docs: http://php.net/manual/en/simplexmlelement.addchild.php#112204

I've provided a simple workaround which avoids the problem