diff --git a/pykusto/query.py b/pykusto/query.py
index 42caba4..272bbaf 100644
--- a/pykusto/query.py
+++ b/pykusto/query.py
@@ -53,7 +53,12 @@ class Query:
         self._table = head if isinstance(head, Table) else None
 
     def __add__(self, other: 'Query'):
-        other._head = self
+        other_base = other
+        while other_base._head is not None:
+            if other_base._head._head is None:
+                break
+            other_base = other_base._head
+        other_base._head = self
         return other
 
     def where(self, predicate: BooleanType) -> 'WhereQuery':

diff --git a/test/test_query.py b/test/test_query.py
index a228e03..034feec 100644
--- a/test/test_query.py
+++ b/test/test_query.py
@@ -15,9 +15,21 @@ class TestQuery(TestBase):
         )
 
     def test_add_queries(self):
-        query = Query().where(col.foo > 4) + Query().take(5) + Query().sort_by(col.bar, Order.ASC, Nulls.LAST)
+        query = (Query().where(col.foo > 4) +
+                 Query().take(5) +
+                 Query().where(col.foo > 1).sort_by(col.bar, Order.ASC, Nulls.LAST))
         self.assertEqual(
-            " | where foo > 4 | take 5 | sort by bar asc nulls last",
+            " | where foo > 4 | take 5 | where foo > 1 | sort by bar asc nulls last",
+            query.render(),
+        )
+
+    def test_add_queries_with_table(self):
+        mock_kusto_client = MockKustoClient()
+        table = PyKustoClient(mock_kusto_client)['test_db']['test_table']
+        b = Query().take(5).take(2).sort_by(col.bar, Order.ASC, Nulls.LAST)
+        query = Query(table).where(col.foo > 4) + b
+        self.assertEqual(
+            "test_table | where foo > 4 | take 5 | take 2 | sort by bar asc nulls last",
             query.render(),
         )
 

query.__add__ only handles short queries
test/test_query.py::TestQuery::test_add_queries test/test_query.py::TestQuery::test_add_queries_with_table
test/test_query.py::TestQuery::test_count test/test_query.py::TestQuery::test_custom test/test_query.py::TestQuery::test_distinct test/test_query.py::TestQuery::test_distinct_all test/test_query.py::TestQuery::test_extend test/test_query.py::TestQuery::test_extend_assign_to_multiple_columns test/test_query.py::TestQuery::test_extend_generate_column_name test/test_query.py::TestQuery::test_join_no_joined_table test/test_query.py::TestQuery::test_join_no_on test/test_query.py::TestQuery::test_join_with_table test/test_query.py::TestQuery::test_join_with_table_and_query test/test_query.py::TestQuery::test_limit test/test_query.py::TestQuery::test_mv_expand test/test_query.py::TestQuery::test_mv_expand_args test/test_query.py::TestQuery::test_mv_expand_no_args test/test_query.py::TestQuery::test_order test/test_query.py::TestQuery::test_order_expression_in_arg test/test_query.py::TestQuery::test_project test/test_query.py::TestQuery::test_project_assign_to_multiple_columns test/test_query.py::TestQuery::test_project_away test/test_query.py::TestQuery::test_project_away_wildcard test/test_query.py::TestQuery::test_project_rename test/test_query.py::TestQuery::test_project_unspecified_column test/test_query.py::TestQuery::test_project_with_expression test/test_query.py::TestQuery::test_sample test/test_query.py::TestQuery::test_sanity test/test_query.py::TestQuery::test_sort test/test_query.py::TestQuery::test_sort_multiple_cols test/test_query.py::TestQuery::test_summarize test/test_query.py::TestQuery::test_summarize_by test/test_query.py::TestQuery::test_summarize_by_expression test/test_query.py::TestQuery::test_take test/test_query.py::TestQuery::test_top test/test_query.py::TestQuery::test_udf test/test_query.py::TestQuery::test_where