Fixed a bug is tree builder.