diff --git a/hpvm/include/SupportVISC/DFG2LLVM.h b/hpvm/include/SupportVISC/DFG2LLVM.h
index 1e45e87ccb5fff42edfa73e077134e7f9337473a..c3db1a77c1aa509c26e8d119b0b8e69b6df910a6 100644
--- a/hpvm/include/SupportVISC/DFG2LLVM.h
+++ b/hpvm/include/SupportVISC/DFG2LLVM.h
@@ -324,11 +324,16 @@ Value* CodeGenTraversal::getStringPointer(const Twine& S, Instruction* IB, const
 //  F->mutateType(PTy);
 //}
 
+void renameNewArgument(Function *newF, const Twine& argName){
+  // Get Last argument in Function Arg List and rename it to given name
+  Argument *lastArg = &*(newF->arg_end() - 1);
+  lastArg->setName(argName);
+}
+
 // Creates a function with an additional argument of the specified type and
 // name. The previous function is not deleted.
 Function *CodeGenTraversal::addArgument(Function* F, Type* Ty, const Twine& name) {
-  // Add the argument to argument list
-  new Argument(Ty, name, F);
+  Argument *new_arg = new Argument(Ty, name);
 
   // Create the argument type list with added argument types
   std::vector<Type*> ArgTypes;
@@ -340,8 +345,11 @@ Function *CodeGenTraversal::addArgument(Function* F, Type* Ty, const Twine& name
   // function type. We need to change the type of this function to reflect the
   // added arguments. So, we create a clone of this function with the correct
   // type.
-  FunctionType* FTy = FunctionType::get(F->getReturnType(), ArgTypes, F->isVarArg());
-  Function *newF = viscUtils::cloneFunction(F, FTy, false);
+  FunctionType *FTy = FunctionType::get(F->getReturnType(), ArgTypes, F->isVarArg());
+  Function *newF = Function::Create(FTy, F->getLinkage(),
+				    F->getName() + "_cloned", F->getParent());
+  renameNewArgument(newF, name);
+  newF = viscUtils::cloneFunction(F, newF, false);
 
   // Check if the function is used by a metadata node
   if(F->isUsedByMetadata()) {