nginx-0.0.1-2003-11-11-21:13:43 import
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 3a0ec8b..3f19b78 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -429,7 +429,7 @@
         return NGX_OK;
     }
 
-    if (r->err_status) {
+    if (r->err_ctx) {
         r->headers_out.status = r->err_status;
         r->headers_out.status_line.len = 0;
     }
@@ -499,17 +499,19 @@
         }
     }
 
-    /* clear the modules contexts */
+    if (r->err_ctx) {
 
-    if (r->error_page) {
-        r->err_status = r->headers_out.status;
-        r->err_ctx = r->ctx;
+        /* allocate the new modules contexts */
+
         r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module);
         if (r->ctx == NULL) {
             return NGX_HTTP_INTERNAL_SERVER_ERROR;
         }
 
     } else {
+
+        /* clear the modules contexts */
+
         ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module);
     }