diff --git a/lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs b/lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs
index c6b149dec8ac7b7493103fbd8512f1e5611f7691..ca4d6bcbb8c451d1a58061f33b448785cc447f4e 100644
--- a/lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs
+++ b/lib/csharp/se/lth/control/labcomm/LabCommDecoderChannel.cs
@@ -169,7 +169,7 @@ namespace se.lth.control.labcomm {
 
       do {
         byte c = decodeByte();
-	res |= (c & 0x7f) << 7*i;
+	res |= (uint) ((c & 0x7f) << 7*i);
         cont = (c & 0x80) != 0;
         i++;
       } while(cont);
diff --git a/lib/csharp/se/lth/control/labcomm/LabCommEncoder.cs b/lib/csharp/se/lth/control/labcomm/LabCommEncoder.cs
index 87008c80243a26c318734c8050c9b0d8895f1135..1ddadd260ec2abfdf2dd69ae2b14d9376d1ddc79 100644
--- a/lib/csharp/se/lth/control/labcomm/LabCommEncoder.cs
+++ b/lib/csharp/se/lth/control/labcomm/LabCommEncoder.cs
@@ -15,6 +15,7 @@ namespace se.lth.control.labcomm {
     void encodeFloat(float value);
     void encodeDouble(double value);
     void encodeString(String value);
+    void encodePacked32(Int64 value);
     
   }
 
diff --git a/lib/csharp/se/lth/control/labcomm/LabCommEncoderChannel.cs b/lib/csharp/se/lth/control/labcomm/LabCommEncoderChannel.cs
index 25f27c84487781362a1c28e6347cb32d7b352149..73ee9047b49569f37f81355d2a4c619aac719023 100644
--- a/lib/csharp/se/lth/control/labcomm/LabCommEncoderChannel.cs
+++ b/lib/csharp/se/lth/control/labcomm/LabCommEncoderChannel.cs
@@ -84,7 +84,7 @@ namespace se.lth.control.labcomm {
 
     public void encodeString(String value) {
       byte[] buf = Encoding.UTF8.GetBytes(value);
-      EncodePacked32(buf.Length, 4);
+      encodePacked32(buf.Length);
       bytes.Write(buf, 0, buf.Length);
     }