Fixed some bugs with double XML escaping