7f6d46
diff --git a/modules/session/mod_session.c b/modules/session/mod_session.c
7f6d46
index 7213eb3..3e73c7a 100644
7f6d46
--- a/modules/session/mod_session.c
7f6d46
+++ b/modules/session/mod_session.c
7f6d46
@@ -126,15 +126,9 @@ static apr_status_t ap_session_load(request_rec * r, session_rec ** z)
7f6d46
 
7f6d46
     /* found a session that hasn't expired? */
7f6d46
     now = apr_time_now();
7f6d46
-    if (!zz || (zz->expiry && zz->expiry < now)) {
7f6d46
-
7f6d46
-        /* no luck, create a blank session */
7f6d46
-        zz = (session_rec *) apr_pcalloc(r->pool, sizeof(session_rec));
7f6d46
-        zz->pool = r->pool;
7f6d46
-        zz->entries = apr_table_make(zz->pool, 10);
7f6d46
-
7f6d46
-    }
7f6d46
-    else {
7f6d46
+    
7f6d46
+    if (zz){
7f6d46
+        /* load the session attibutes */
7f6d46
         rv = ap_run_session_decode(r, zz);
7f6d46
         if (OK != rv) {
7f6d46
             ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01817)
7f6d46
@@ -142,8 +136,22 @@ static apr_status_t ap_session_load(request_rec * r, session_rec ** z)
7f6d46
                           "session not loaded: %s", r->uri);
7f6d46
             return rv;
7f6d46
         }
7f6d46
+        
7f6d46
+        /* invalidate session if session is expired */
7f6d46
+        if (zz && zz->expiry && zz->expiry < now){
7f6d46
+           zz = NULL;
7f6d46
+        }
7f6d46
     }
7f6d46
 
7f6d46
+    if (!zz || (zz->expiry && zz->expiry < now)) {
7f6d46
+
7f6d46
+        /* no luck, create a blank session */
7f6d46
+        zz = (session_rec *) apr_pcalloc(r->pool, sizeof(session_rec));
7f6d46
+        zz->pool = r->pool;
7f6d46
+        zz->entries = apr_table_make(zz->pool, 10);
7f6d46
+
7f6d46
+    }
7f6d46
+    
7f6d46
     /* make sure the expiry is set, if present */
7f6d46
     if (!zz->expiry && dconf->maxage) {
7f6d46
         zz->expiry = now + dconf->maxage * APR_USEC_PER_SEC;