diff --git a/www/saml2/sp/AssertionConsumerService.php b/www/saml2/sp/AssertionConsumerService.php
index 99e0018714d863e080185a08e980b0a2142e280b..13fad5ce9e79b886387d734ad8adf8236dd66a0c 100644
--- a/www/saml2/sp/AssertionConsumerService.php
+++ b/www/saml2/sp/AssertionConsumerService.php
@@ -3,6 +3,7 @@
 require_once('../../_include.php');
 
 
+require_once('SimpleSAML/Configuration.php');
 require_once('SimpleSAML/Utilities.php');
 require_once('SimpleSAML/Session.php');
 require_once('SimpleSAML/Logger.php');
@@ -21,6 +22,7 @@ require_once('SimpleSAML/XHTML/Template.php');
  * @abstract
  */
 
+$config = SimpleSAML_Configuration::getInstance();
 
 /* Get the session object for the user. Create a new session if no session
  * exists for this user.
@@ -35,7 +37,6 @@ if (!$config->getValue('enable.saml20-sp', false))
 	
 try {
 	
-	$config = SimpleSAML_Configuration::getInstance();	
 	$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
 
 	$binding = new SimpleSAML_Bindings_SAML20_HTTPPost($config, $metadata);
diff --git a/www/saml2/sp/initSLO.php b/www/saml2/sp/initSLO.php
index 70ce06cdc135e9a14f1ba48d0fbf74a23890d22f..afc19688ed24d1f60a82be0465c10ebe961b4e10 100644
--- a/www/saml2/sp/initSLO.php
+++ b/www/saml2/sp/initSLO.php
@@ -2,6 +2,7 @@
 
 require_once('../../_include.php');
 
+require_once('SimpleSAML/Configuration.php');
 require_once('SimpleSAML/Logger.php');
 require_once('SimpleSAML/Utilities.php');
 require_once('SimpleSAML/Session.php');
@@ -9,6 +10,7 @@ require_once('SimpleSAML/Metadata/MetaDataStorageHandler.php');
 require_once('SimpleSAML/XML/SAML20/LogoutRequest.php');
 require_once('SimpleSAML/Bindings/SAML20/HTTPRedirect.php');
 
+$config = SimpleSAML_Configuration::getInstance();
 
 $session = SimpleSAML_Session::getInstance();
 
@@ -22,7 +24,6 @@ if (isset($session) ) {
 	
 	try {
 	
-		$config = SimpleSAML_Configuration::getInstance();
 		$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
 	
 		$idpentityid = $session->getIdP();
diff --git a/www/shib13/sp/AssertionConsumerService.php b/www/shib13/sp/AssertionConsumerService.php
index b6f34e85b8ef2159c0a3fa9f502efa8d39c7d24d..675172a28f4411d4c0cd794f1ba1a263cff42e43 100644
--- a/www/shib13/sp/AssertionConsumerService.php
+++ b/www/shib13/sp/AssertionConsumerService.php
@@ -3,6 +3,7 @@
 require_once('../../_include.php');
 
 
+require_once('SimpleSAML/Configuration.php');
 require_once('SimpleSAML/Utilities.php');
 require_once('SimpleSAML/Session.php');
 require_once('SimpleSAML/Metadata/MetaDataStorageHandler.php');
@@ -10,6 +11,8 @@ require_once('SimpleSAML/XML/Shib13/AuthnRequest.php');
 require_once('SimpleSAML/Bindings/Shib13/HTTPPost.php');
 require_once('SimpleSAML/XHTML/Template.php');
 
+$config = SimpleSAML_Configuration::getInstance();
+
 $session = SimpleSAML_Session::getInstance(TRUE);
 
 
@@ -20,7 +23,6 @@ if (!$config->getValue('enable.shib13-sp', false))
 
 try {
 
-	$config = SimpleSAML_Configuration::getInstance();
 	$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
 
 	$binding = new SimpleSAML_Bindings_Shib13_HTTPPost($config, $metadata);