Fix errors & warnings
Use tree as map