Fix tree query.