diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php
index cc68ea4203f8e46a24b12b3ccbd500a59ad322e8..8bdde73f66017d244ffa5854c64ae97cef2e4e87 100644
--- a/lib/SimpleSAML/Session.php
+++ b/lib/SimpleSAML/Session.php
@@ -506,11 +506,12 @@ class SimpleSAML_Session {
 	/**
 	 * This function registers a logout handler.
 	 *
+	 * @param string $authority The authority for which register the handler.
 	 * @param string $classname The class which contains the logout handler.
 	 * @param string $functionname The logout handler function.
 	 * @throws Exception If the handler is not a valid function or method.
 	 */
-	public function registerLogoutHandler($classname, $functionname) {
+	public function registerLogoutHandler($authority, $classname, $functionname) {
 		assert('isset($this->authData[$this->authority])');
 
 		$logout_handler = array($classname, $functionname);
@@ -521,7 +522,7 @@ class SimpleSAML_Session {
 		}
 
 
-		$this->authData[$this->authority]['LogoutHandlers'][] = $logout_handler;
+		$this->authData[$authority]['LogoutHandlers'][] = $logout_handler;
 		$this->dirty = TRUE;
 	}
 
diff --git a/www/authmemcookie.php b/www/authmemcookie.php
index dc52fc2c3eb02157514d4280fe2dce49ba03b0cd..8acd307944fba857ae3dd79a1490140876ffb62e 100644
--- a/www/authmemcookie.php
+++ b/www/authmemcookie.php
@@ -90,7 +90,7 @@ try {
 
 	/* Register logout handler. */
 	$session = SimpleSAML_Session::getSessionFromRequest();
-	$session->registerLogoutHandler('SimpleSAML_AuthMemCookie', 'logoutHandler');
+	$session->registerLogoutHandler($sourceId, 'SimpleSAML_AuthMemCookie', 'logoutHandler');
 
 	/* Redirect the user back to this page to signal that the login is completed. */
 	SimpleSAML_Utilities::redirectTrustedURL(SimpleSAML_Utilities::selfURL());