Tree generator now adds proper join conditions to joins where possible