Fix bug in extracting empty tree.