diff --git a/lib/python/labcomm2014/LabComm.py b/lib/python/labcomm2014/LabComm.py
index 208b92f172dcba3d6503ae43878ad9c2e056747c..bff63defd36c6d0b062b647b6941006054eca634 100644
--- a/lib/python/labcomm2014/LabComm.py
+++ b/lib/python/labcomm2014/LabComm.py
@@ -375,6 +375,9 @@ class SAMPLE(primitive):
         return encoder.encode_type(i_SAMPLE)
 
     def encode(self, encoder, value):
+        if not isinstance(value, type_decl):
+            # Probably trying to encode a sample class, grab signature
+            value = value.signature
         return encoder.encode_int(encoder.ref_to_index.get(value, 0))
     
     def decode(self, decoder, obj=None):
@@ -729,6 +732,9 @@ class Codec(object):
         return True
         
     def add_ref(self, ref, index=0):
+        if not isinstance(ref, type_decl):
+            # Probably trying to register a sample class, grab signature
+            ref = ref.signature
         if index == 0:
             if ref.sample in self.ref_to_index:
                 return False
@@ -783,15 +789,16 @@ class Encoder(Codec):
                 decl.encode_decl(self)
             self.writer.mark_end(decl, None)
  
-    def add_ref(self, decl, index=0):
-        if not isinstance(decl, type_decl):
-            decl = decl.signature
-        ref = sample_ref(name=decl.name, decl=decl.decl, sample=decl)
+    def add_ref(self, ref, index=0):
+        if not isinstance(ref, type_decl):
+            # Trying to register a sample class
+            ref = ref.signature
+        decl = sample_ref(name=ref.name, decl=ref.decl, sample=ref)
         if index == 0:
-            self.writer.mark_begin(decl, None)
-            if super(Encoder, self).add_ref(ref, index):
-                ref.encode_decl(self)
-            self.writer.mark_end(decl, None)
+            self.writer.mark_begin(ref, None)
+            if super(Encoder, self).add_ref(decl, index):
+                decl.encode_decl(self)
+            self.writer.mark_end(ref, None)
  
     def encode(self, object, decl=None):
         if decl == None:
diff --git a/packaging/make_srpm b/packaging/make_srpm
index 4925a831fe89f74a3bb3c0c45487540b1ba559d4..b62f47bdbd20bbfe6fdbb27078baa68bd5af8f8d 100755
--- a/packaging/make_srpm
+++ b/packaging/make_srpm
@@ -68,7 +68,7 @@ install -m u=r,g=r,o=r lib/csharp/labcomm2014.dll ${RPM_BUILD_ROOT}/usr/lib
 # Python
 #
 install -d ${RPM_BUILD_ROOT}/%{python_sitelib}/labcomm2014
-install lib/python/labcomm/* ${RPM_BUILD_ROOT}/%{python_sitelib}/labcomm2014
+install lib/python/labcomm2014/* ${RPM_BUILD_ROOT}/%{python_sitelib}/labcomm2014
 
 %files
 %defattr (-, root, root)