diff --git a/libIRDB/include/core/file.hpp b/libIRDB/include/core/file.hpp
index 5a33f8aa4c475183403d2192511c9365a1c6ddde..8c30dc9a74fcb2cd496f553e4045b768d6e96ec9 100644
--- a/libIRDB/include/core/file.hpp
+++ b/libIRDB/include/core/file.hpp
@@ -49,6 +49,7 @@ class File_t : public BaseObj_t
 	void CreateTables();
 
 	int GetELFOID() const { return elfoid; };
+	db_id_t GetFileID() const {return orig_fid; };
 
         friend class FileIR_t;
         friend class Function_t;
diff --git a/libtransform/src/Rewrite_Utility.cpp b/libtransform/src/Rewrite_Utility.cpp
index 355342b8748a4683727491d6712bd8853d4f3899..6df1334214ea74d19a915aaf4a0ab2af7401f8ea 100644
--- a/libtransform/src/Rewrite_Utility.cpp
+++ b/libtransform/src/Rewrite_Utility.cpp
@@ -149,7 +149,7 @@ Instruction_t* addNewDatabits(FileIR_t* firp, Instruction_t *p_instr, string p_b
         if (p_instr)
                 newinstr = allocateNewInstruction(firp,p_instr->GetAddress()->GetFileID(), p_instr->GetFunction());
         else
-                newinstr = allocateNewInstruction(firp,BaseObj_t::NOT_IN_DATABASE, NULL);
+                newinstr = allocateNewInstruction(firp,firp->GetFile()->GetFileID(), NULL);
 
         newinstr->SetDataBits(p_bits);
 
@@ -168,7 +168,7 @@ Instruction_t* addNewAssembly(FileIR_t* firp, Instruction_t *p_instr, string p_a
         if (p_instr)
                 newinstr = allocateNewInstruction(firp,p_instr->GetAddress()->GetFileID(), p_instr->GetFunction());
         else
-                newinstr = allocateNewInstruction(firp,BaseObj_t::NOT_IN_DATABASE, NULL);
+                newinstr = allocateNewInstruction(firp,firp->GetFile()->GetFileID(), NULL);
 
         firp->RegisterAssembly(newinstr, p_asm);