fixed tree_map examples and small bugs