diff --git a/src/uws/service/UWSService.java b/src/uws/service/UWSService.java
index 968a0990f9ed0f59b6e1e13638bbce2d4f957e0d..01acdeb6624f516b41397054a5c0b44f2abecc64 100644
--- a/src/uws/service/UWSService.java
+++ b/src/uws/service/UWSService.java
@@ -1140,7 +1140,7 @@ public class UWSService implements UWS {
 			// Apply the redirection:
 			redirect(error.getMessage(), request, user, uwsAction, response);
 		}else
-			sendError(error, request, reqID, user, uwsAction, response);
+			sendError((Exception)error, request, reqID, user, uwsAction, response);
 	}
 
 	/**
diff --git a/src/uws/service/UWSServlet.java b/src/uws/service/UWSServlet.java
index 2936d8dab7a19284d3cc9a83e5f5dcb25cb5af96..33d8b4a48e7221cf398e3e3b8fa77d18e05792fc 100644
--- a/src/uws/service/UWSServlet.java
+++ b/src/uws/service/UWSServlet.java
@@ -501,7 +501,7 @@ public abstract class UWSServlet extends HttpServlet implements UWS, UWSFactory
 				InputStream input = null;
 				try{
 					input = getFileManager().getErrorInput(error, job);
-					UWSToolBox.write(input, "text/plain", getFileManager().getErrorSize(error, job), resp);
+					UWSToolBox.write(input, errorWriter.getErrorDetailsMIMEType(), getFileManager().getErrorSize(error, job), resp);
 				}catch(IOException ioe){
 					getLogger().logUWS(LogLevel.ERROR, error, "GET_ERROR", "Can not read the details of the error summary of the job \"" + job.getJobId() + "\"!", ioe);
 					throw new UWSException(UWSException.INTERNAL_SERVER_ERROR, ioe, "Can not read the error details (job ID: " + job.getJobId() + ").");
@@ -649,7 +649,7 @@ public abstract class UWSServlet extends HttpServlet implements UWS, UWSFactory
 				throw new ServletException("Can not redirect the response! You should notify the administrator of the service (FATAL-" + reqID + "). However, while waiting a correction of this problem, you can manually go toward " + error.getMessage() + ".");
 			}
 		}else
-			sendError(error, request, reqID, user, uwsAction, response);
+			sendError((Exception)error, request, reqID, user, uwsAction, response);
 	}
 
 	/**