Fixed bug in TreeSerialization