diff --git a/activity.hpp b/activity.hpp
index 9382a2d5caaa5c20854b066c7d190ee9ab399df5..470f035c5471ab30078d00bab95df4bd250874ec 100644
--- a/activity.hpp
+++ b/activity.hpp
@@ -160,9 +160,10 @@ namespace CIS {
         bool prevOperationIsSequential = true;
         rlib::string xamlCode;
 
-        // For a long expression A >> B >> C >> D, A is in xamlCode, and [B,C,D] are cached in queuedOnRight to wait for merge. 
+        // If representing a long expression A >> B >> C >> D, A is in xamlCode, and [B,C,D] are cached in queuedOnRight to wait for merge. 
         std::list<rlib::string> queuedOnRight;
 
+        // Consumes this and seqNext, and create a new Flow representing the merged Flow. 
         Flow binaryOperation(Flow seqNext, bool thisOperationIsSequential) const {
             Flow result = *this;
             result.reduceQueuedIfNecessary(thisOperationIsSequential);
@@ -176,6 +177,8 @@ namespace CIS {
             return result;
         }
 
+        // If we are going to perform a different binary operation, we need to merge xamlCode and queuedOnRight into this.xamlCode, to keep the queue clear. 
+        // If we are going to perform the previous binary operation again, we don't need to reduce the queue, and this function does nothing. 
         void reduceQueuedIfNecessary(bool thisOperationIsSequential) {
             if(thisOperationIsSequential == prevOperationIsSequential || queuedOnRight.empty()) return;
             rlib::string resultXaml = prevOperationIsSequential ? templates::SEQ_BEGIN : templates::PAR_BEGIN;
@@ -231,7 +234,14 @@ namespace CIS {
 
     inline auto Flow::generateXaml(Metadata metadata) const {
         Flow finalized(*this);
-        finalized.reduceQueuedIfNecessary(!finalized.prevOperationIsSequential); // Always necessary if queue is not empty.
+        if(finalized.queuedOnRight.empty()) {
+            // If the queue is empty, it means there is only one activity in the workflow. 
+            // We must wrap it with a SEQuence, or CIS will fail with internal error. 
+            finalized.xamlCode = templates::SEQ_BEGIN + finalized.xamlCode + templates::SEQ_END;
+        } else {
+            // Merge all pending elements into one. 
+            finalized.reduceQueuedIfNecessary(!finalized.prevOperationIsSequential);
+        }
         return metadata.generateXamlHead() + dirty_plugins::patchGS(finalized.xamlCode) + metadata.generateXamlTail();
     }
     inline auto Flow::generateXaml(std::string className) const {
diff --git a/workflows/qatar-notify.cc b/workflows/qatar-notify.cc
index e537945f023318085280239a9e1e0fc163e24af1..fc14756342dd732a0d140182cd86db9cfe95d0a1 100644
--- a/workflows/qatar-notify.cc
+++ b/workflows/qatar-notify.cc
@@ -6,6 +6,6 @@ int main() {
             .addInputSetting("RunAsDaemon", "true")
         ;
 
-    println(to_file("AlarmingDaemonWorkflow.xaml"), flow.generateXaml("Microsoft.Office.FleetAGC.Workflows.AlarmingDaemonWorkflow"));
+    println(to_file("AlarmingDaemonWorkflow.xaml"), flow.generateXaml("FleetAGC.Workflows.AlarmingDaemonWorkflow"));
 }
 
diff --git a/workflows/sendemail.cc b/workflows/sendemail.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9dbddb0e5fd05631dd8c82d6924d48943831791c
--- /dev/null
+++ b/workflows/sendemail.cc
@@ -0,0 +1,14 @@
+#include <cis-workflow-gen/quick-include.hpp>
+
+int main() {
+    Flow flow =
+        Activity("SendEmail", "FleetAGC.Activities.SendEmailActivity")
+            .addInputSetting("to", CS(GlobalSettings["to"]))
+            .addInputSetting("title", CS(GlobalSettings["title"]))
+            .addInputSetting("content_b64", CS(GlobalSettings["content_b64"])) >> Noop("Noop")
+            ;
+
+
+    println(to_file("SendEmailActivityWorkflow.xaml"), flow.generateXaml("M365AGCBuildout.Workflows.SendEmailActivityWorkflow"));
+}
+
diff --git a/xaml-template.hpp b/xaml-template.hpp
index 8417b8d7e3719cee5548ac2dbd6c597a8916295b..430475a60c23a9e462e4e34cda9d957eb80d2f9a 100644
--- a/xaml-template.hpp
+++ b/xaml-template.hpp
@@ -89,7 +89,7 @@ __TEMPLATE_ARG_XtraNamespaces  </sco:Collection>
       <AssemblyReference>System.Xml</AssemblyReference>
       <AssemblyReference>System.Xml.Linq</AssemblyReference>
       <AssemblyReference>mscorlib</AssemblyReference>
-      <AssemblyReference>Microsoft.Office.FleetAGC.Activities</AssemblyReference>
+      <AssemblyReference>FleetAGC.Activities</AssemblyReference>
 __TEMPLATE_ARG_XtraAssemblies  </sco:Collection>
   </TextExpression.ReferencesForImplementation>
 )XAML";