Fixed a dynamic memory allocation problem in the root writer.