bug fixes to update leaf node count of root