Fixed bug in TreePartition