Fix subtree bug, improve logging.