Fix branchnode and leafnode