fixing more bugs in subtree method