diff --git a/irdb-libs/libIRDB-transform/src/rewrite_util.cpp b/irdb-libs/libIRDB-transform/src/rewrite_util.cpp
index 268f57d8bfed0860c830d6f58942bf30b3324069..3fdf0456a259e7cfb8e8794d6e93c7f5a336cdde 100644
--- a/irdb-libs/libIRDB-transform/src/rewrite_util.cpp
+++ b/irdb-libs/libIRDB-transform/src/rewrite_util.cpp
@@ -52,6 +52,9 @@ Instruction_t* IRDB_SDK::insertAssemblyBefore(FileIR_t* virp, Instruction_t* fir
 	next->setOriginalAddressID(first->getOriginalAddressID());
 	//"Null" out the original address (it should be as if the instruction was not in the database).
 	first->setOriginalAddressID(BaseObj_t::NOT_IN_DATABASE);
+	// Keep Base ID in the original instruction
+	next->setBaseID(first->getBaseID());
+	first->setBaseID(BaseObj_t::NOT_IN_DATABASE);
 	auto real_first=dynamic_cast<libIRDB::Instruction_t*>(first);
 	assert(real_first);
 	real_first->GetRelocations().clear();
@@ -121,6 +124,9 @@ Instruction_t* IRDB_SDK::insertDataBitsBefore(FileIR_t* virp, Instruction_t* fir
         next->setOriginalAddressID(first->getOriginalAddressID());
         //"Null" out the original address (it should be as if the instruction was not in the database).
         first->setOriginalAddressID(BaseObj_t::NOT_IN_DATABASE);
+		// Keep Base ID in the original instruction
+		next->setBaseID(first->getBaseID());
+		first->setBaseID(BaseObj_t::NOT_IN_DATABASE);
 	auto real_first=dynamic_cast<libIRDB::Instruction_t*>(first);
 	assert(real_first);
         real_first->GetRelocations().clear();