Fixed a bug that would cause the root element name to missed in some cases.