diff --git a/lib/SimpleSAML/XML/Shib13/AuthnRequest.php b/lib/SimpleSAML/XML/Shib13/AuthnRequest.php
index 428aa60643de597f1138f6e787d2eaceaa359642..3426375af43b2db2c524c8f276c3a0c24a971cda 100644
--- a/lib/SimpleSAML/XML/Shib13/AuthnRequest.php
+++ b/lib/SimpleSAML/XML/Shib13/AuthnRequest.php
@@ -10,7 +10,6 @@
  */
 class SimpleSAML_XML_Shib13_AuthnRequest {
 
-	private $configuration = null;
 	private $metadata = null;
 	
 	private $issuer = null;
@@ -23,9 +22,7 @@ class SimpleSAML_XML_Shib13_AuthnRequest {
 	const PROTOCOL = 'shib13';
 
 
-	function __construct(SimpleSAML_Configuration $configuration, SimpleSAML_Metadata_MetaDataStorageHandler $metadatastore) {
-		$this->configuration = $configuration;
-		$this->metadata = $metadatastore;
+	function __construct() {
 		
 		$this->requestid = SimpleSAML_Utilities::generateID();
 	}
@@ -76,16 +73,19 @@ class SimpleSAML_XML_Shib13_AuthnRequest {
 	}
 
 	
-	public function createRedirect($destination) {
-		$idpmetadata = $this->metadata->getMetaData($destination, 'shib13-idp-remote');
-		$spmetadata = $this->metadata->getMetaData($this->getIssuer(), 'shib13-sp-hosted');
-	
+	public function createRedirect($destination, $shire = NULL) {
+		$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
+		$idpmetadata = $metadata->getMetaData($destination, 'shib13-idp-remote');
+
+		if ($shire === NULL) {
+			$shire = $metadata->getGenerated('AssertionConsumerService', 'shib13-sp-hosted');
+		}
+
 		if (!isset($idpmetadata['SingleSignOnService'])) {
 			throw new Exception('Could not find the SingleSignOnService parameter in the Shib 1.3 IdP Remote metadata. This parameter has changed name from an earlier version of simpleSAMLphp, when it was called SingleSignOnUrl. Please check your shib13-sp-remote.php configuration the IdP with entity id ' . $destination . ' and make sure the SingleSignOnService parameter is set.');
 		}
 		
 		$desturl = $idpmetadata['SingleSignOnService'];
-		$shire = $this->metadata->getGenerated('AssertionConsumerService', 'shib13-sp-hosted');
 		$target = $this->getRelayState();
 		
 		$url = $desturl . '?' .
diff --git a/www/shib13/sp/initSSO.php b/www/shib13/sp/initSSO.php
index 3a3b185ecde8c375f89487af12b384b5b967547a..e538e28fbabd337587f9ab64ab48f274c08cb4f3 100644
--- a/www/shib13/sp/initSSO.php
+++ b/www/shib13/sp/initSSO.php
@@ -67,7 +67,7 @@ if (!isset($session) || !$session->isValid('shib13') ) {
 	
 	
 	try {
-		$ar = new SimpleSAML_XML_Shib13_AuthnRequest($config, $metadata);
+		$ar = new SimpleSAML_XML_Shib13_AuthnRequest();
 		$ar->setIssuer($spentityid);	
 		if(isset($_GET['RelayState'])) 
 			$ar->setRelayState($_GET['RelayState']);