diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php
index 99bde5aad70844988c22aaae15c82a4022708292..4fa4ff68fee0496ae12b19465085405a5ccb9f32 100644
--- a/lib/SimpleSAML/Session.php
+++ b/lib/SimpleSAML/Session.php
@@ -457,12 +457,20 @@ class SimpleSAML_Session {
 	/**
 	 * This function registers a logout handler.
 	 *
-	 * @param $file  The file which contains the logout handler.
 	 * @param $classname  The class which contains the logout handler.
 	 * @param $functionname  The logout handler function.
 	 */
-	public function registerLogoutHandler($file, $classname, $functionname) {
-		$this->logout_handlers[] = array('file' => $file, 'class' => $classname, 'function' => $functionname);
+	public function registerLogoutHandler($classname, $functionname) {
+
+		$logout_handler = array($classname, $functionname);
+
+		if(!is_callable($logout_handler)) {
+			throw new Exception('Logout handler is not a vaild function: ' . $classname . '::' .
+				$functionname);
+		}
+
+
+		$this->logout_handlers[] = $logout_handler;
 		$this->dirty = TRUE;
 	}
 
@@ -473,13 +481,20 @@ class SimpleSAML_Session {
 	private function callLogoutHandlers() {
 		foreach($this->logout_handlers as $handler) {
 
-			/* Load the file with the logout handler. */
-			require_once((isset($SIMPLESAML_INCPREFIX)?$SIMPLESAML_INCPREFIX:'') . $handler['file']);
+			$logout_handler = array($classname, $functionname);
+
+			/* Verify that the logout handler is a valid function. */
+			if(!is_callable($logout_handler)) {
+				$classname = $logout_handler[0];
+				$functionname = $logout_handler[1];
+
+				throw new Exception('Logout handler is not a vaild function: ' . $classname . '::' .
+					$functionname);
+			}
 
 			/* Call the logout handler. */
-			$classname = $handler['class'];
-			$functionname = $handler['function'];
-			call_user_func(array($classname, $functionname));
+			call_user_func($logout_handler);
+
 		}
 
 		/* We require the logout handlers to register themselves again if they want to be called later. */
diff --git a/www/authmemcookie.php b/www/authmemcookie.php
index 7fdc7a5e1a637af8bc57fb2b2e74e323a15e4dde..59247978d8b0a807757924ca272692d94eb6ef82 100644
--- a/www/authmemcookie.php
+++ b/www/authmemcookie.php
@@ -94,7 +94,7 @@ try {
 	$memcache->set($sessionID, $data);
 
 	/* Register logout handler. */
-	$session->registerLogoutHandler('SimpleSAML/AuthMemCookie.php', 'SimpleSAML_AuthMemCookie', 'logoutHandler');
+	$session->registerLogoutHandler('SimpleSAML_AuthMemCookie', 'logoutHandler');
 
 	/* Redirect the user back to this page to signal that the login is completed. */
 	SimpleSAML_Utilities::redirect(SimpleSAML_Utilities::selfURL());