diff --git a/Code/ApplicationEngine/otbWrapperInputProcessXMLParameter.cxx b/Code/ApplicationEngine/otbWrapperInputProcessXMLParameter.cxx
index 27981c413bedc97c0320be638cace649bad57510..52eb3c4d17e60bb34ab3453a781d09e8241322c7 100644
--- a/Code/ApplicationEngine/otbWrapperInputProcessXMLParameter.cxx
+++ b/Code/ApplicationEngine/otbWrapperInputProcessXMLParameter.cxx
@@ -156,8 +156,8 @@ InputProcessXMLParameter::Read(Application::Pointer this_)
 
   if (!doc.LoadFile(fp , TIXML_ENCODING_UTF8))
     {
-    itkExceptionMacro(<< "Can't open file " << m_FileName);
     fclose(fp);
+    itkExceptionMacro(<< "Can't open file " << m_FileName);
     }
 
   TiXmlHandle handle(&doc);
@@ -276,10 +276,13 @@ InputProcessXMLParameter::Read(Application::Pointer this_)
       else if (type == ParameterType_OutputImage)
         {
         OutputImageParameter *paramDown = dynamic_cast<OutputImageParameter*>(param);
-        paramDown->SetFileName(value);
-        std::string pixTypeAsString  = GetChildNodeTextOf(n_Parameter, "pixtype");
-        ImagePixelType outPixType = GetPixelTypeFromString(pixTypeAsString);
-        paramDown->SetPixelType(outPixType);
+        if(paramDown!=NULL)
+          {
+          paramDown->SetFileName(value);
+          std::string pixTypeAsString  = GetChildNodeTextOf(n_Parameter, "pixtype");
+          ImagePixelType outPixType = GetPixelTypeFromString(pixTypeAsString);
+          paramDown->SetPixelType(outPixType);
+          }
         }
       else if (type == ParameterType_ComplexOutputImage)
         {
diff --git a/Code/ApplicationEngine/otbWrapperOutputProcessXMLParameter.cxx b/Code/ApplicationEngine/otbWrapperOutputProcessXMLParameter.cxx
index 5063b5fbe0d4e181f3f1862a2442f971548a6b79..d85c0d85edffb8f37c0f678301c4ccc9715586b4 100644
--- a/Code/ApplicationEngine/otbWrapperOutputProcessXMLParameter.cxx
+++ b/Code/ApplicationEngine/otbWrapperOutputProcessXMLParameter.cxx
@@ -180,15 +180,19 @@ OutputProcessXMLParameter::Write(Application::Pointer app)
        if (type == ParameterType_Empty)
          {
            EmptyParameter* eParam = dynamic_cast<EmptyParameter *> (param);
-           //Dont use app->HasUserValue which returns false always because of
-           //EmptyParameter::HasValue() is false for EmptyParameter
-           if(eParam->HasUserValue())
+
+           if(eParam!=NULL)
              {
-             paramExists = true;
-             emptyValue = "false";
-             if( eParam->GetActive() )
+             //Dont use app->HasUserValue which returns false always because of
+             //EmptyParameter::HasValue() is false for EmptyParameter
+             if(eParam->HasUserValue())
                {
-               emptyValue = "true";
+               paramExists = true;
+               emptyValue = "false";
+               if( eParam->GetActive() )
+                 {
+                 emptyValue = "true";
+                 }
                }
              }
          }
@@ -207,8 +211,11 @@ OutputProcessXMLParameter::Write(Application::Pointer app)
           {
            OutputImageParameter *imgParam = dynamic_cast<OutputImageParameter *>(param);
            value = imgParam->GetFileName();
-           ImagePixelType pixType = imgParam->GetPixelType();
-           pixelTypeAsString = pixelTypeToString(pixType);
+           if(imgParam!=NULL)
+             {
+             ImagePixelType pixType = imgParam->GetPixelType();
+             pixelTypeAsString = pixelTypeToString(pixType);
+             }
          }
          else if( type == ParameterType_InputImageList || type == ParameterType_InputFilenameList ||
                   type == ParameterType_InputVectorDataList || type == ParameterType_StringList ||