diff --git a/libIRDB/src/core/instruction.cpp b/libIRDB/src/core/instruction.cpp
index acef37f5d25141b020335d400673824729016a7a..ab6df69d3ba1707b95d5600a43f07038931cfc60 100644
--- a/libIRDB/src/core/instruction.cpp
+++ b/libIRDB/src/core/instruction.cpp
@@ -226,12 +226,12 @@ bool Instruction_t::IsFunctionExit() const
 
 	/* if there's a target that's outside this function */
 	Instruction_t *target=GetTarget();
-	if(target && !is_in_set(my_function->GetInstructions(),target))
+	if(target && target->GetFunction()!=GetFunction()) // !is_in_set(my_function->GetInstructions(),target))
 		return true;
 
 	/* if there's a fallthrough that's outside this function */
 	Instruction_t *ft=GetFallthrough();
-	if(fallthrough && !is_in_set(my_function->GetInstructions(),ft))
+	if(fallthrough && ft->GetFunction()!=GetFunction()) // !is_in_set(my_function->GetInstructions(),ft))
 		return true;
 
 	/* some instructions have no next-isntructions defined in the db, and we call them function exits */
diff --git a/libIRDB/test/fix_calls.cpp b/libIRDB/test/fix_calls.cpp
index 51ed3f794a5d54c1acbd51b76c70c4ef82bab072..734d09317b5f3ccf27cc6fbdfaf076d3a4ce9797 100644
--- a/libIRDB/test/fix_calls.cpp
+++ b/libIRDB/test/fix_calls.cpp
@@ -731,8 +731,7 @@ bool can_skip_safe_function(Instruction_t *call_insn)
 		return false;
 
 	/* if the call instruction isn't to a function entry point */
-	ControlFlowGraph_t* cfg=new ControlFlowGraph_t(func);
-	if(cfg->GetEntry()->GetInstructions()[0]!=target)
+	if(func->GetEntryPoint()!=target)
 	{
 		return false;
 	}