diff --git a/fastbit/fastbit-ibis1.3.5/src/bord.cpp b/fastbit/fastbit-ibis1.3.5/src/bord.cpp
index c22ce0b..e43d90c 100755
--- a/fastbit/fastbit-ibis1.3.5/src/bord.cpp
+++ b/fastbit/fastbit-ibis1.3.5/src/bord.cpp
@@ -443,21 +443,7 @@ ibis::bord::bord(const char *tn, const char *td,
 		if (refcol != 0) {
 		    ibis::TYPE_T t = refcol->type();
 		    if (refcol->type() == ibis::CATEGORY) {
-			const ibis::dictionary *dic0 = 
-			    static_cast<const ibis::category*>(refcol)
-			    ->getDictionary();
-			bool samedict = (dic0 != 0);
-			for (unsigned i = 1; samedict && i < ref.size(); ++ i) {
-			    const ibis::category *cat1 =
-				dynamic_cast<const ibis::category*>
-				(ref[i]->getColumn(refcol->name()));
-			    if (cat1 != 0) {
-				const ibis::dictionary *dic1 =
-				    cat1->getDictionary();
-				samedict = dic0->equal_to(*dic1);
-			    }
-			}
-			t = (samedict ? ibis::UINT : ibis::CATEGORY);
+			t = ibis::UINT;
 		    }
 		    ibis::bord::column *col = new ibis::bord::column
 			(this, t, cname, 0, sc.aggName(j));
@@ -11498,12 +11484,32 @@ long ibis::bord::column::append(const ibis::column& scol,
 	break;}
     case ibis::UINT: {
 	std::unique_ptr< array_t<uint32_t> > vals(scol.selectUInts(msk));
+        const ibis::bord::column *bc =
+            dynamic_cast<const ibis::bord::column*>(&scol);
 	if (dic == 0) {
-	    const ibis::bord::column *bc =
-		dynamic_cast<const ibis::bord::column*>(&scol);
 	    if (bc != 0)
 		dic = bc->dic;
-	}
+	} else if (bc != nullptr && dic != bc->getDictionary()) {
+            // the dictionaries are different.  merge the source
+            // dictionary and remap the source column
+            if (this->own_dic.get() == nullptr) {
+                this->own_dic.reset(new ibis::dictionary(*dic));
+                this->dic = this->own_dic.get();
+            }
+            const ibis::dictionary* sdic = bc->getDictionary();
+            this->own_dic->merge(*sdic);
+            uint32_t oldToNew[sdic->size()];
+            for (uint32_t i = 0; i < sdic->size(); i++) {
+                const char* sstr = (*sdic)[i];
+                oldToNew[i] = (*dic)[sstr];
+            }
+            if (vals.get() != nullptr) {
+                array_t<uint32_t>* valsp = vals.get();
+                for (uint32_t i = 0; i < valsp->size(); i++) {
+                    (*valsp)[i] = oldToNew[(*valsp)[i]];
+                }
+            }
+        }
 	if (vals.get() != 0)
 	    ierr = addIncoreData(reinterpret_cast<array_t<uint32_t>*&>(buffer),
 				 thePart->nRows(), *vals,
