maintain tree in callback