Fix tree creation