Improved tree support and fixed lack of tree generation (fixes #101).