Improve error reporting in tree