Tree bug fixes