diff --git a/www/saml2/idp/SSOService.php b/www/saml2/idp/SSOService.php
index 10345193e717ddcdd76dcc1ba3049be92ffb2307..510faba418957c19e8a8a50f535cab4cbc314cd6 100644
--- a/www/saml2/idp/SSOService.php
+++ b/www/saml2/idp/SSOService.php
@@ -187,8 +187,7 @@ if($needAuth && !$isPassive) {
 	$authId = SimpleSAML_Utilities::generateID();
 	$session->setAuthnRequest('saml2', $authId, $requestcache);
 
-	$redirectTo = SimpleSAML_Utilities::selfURLNoQuery() .
-		'?RequestID=' . urlencode($authId);
+	$redirectTo = SimpleSAML_Utilities::selfURLNoQuery() . '?RequestID=' . urlencode($authId);
 	$authurl = '/' . $config->getBaseURL() . $idpmetadata['auth'];
 
 	SimpleSAML_Utilities::redirect($authurl, array(
diff --git a/www/shib13/idp/SSOService.php b/www/shib13/idp/SSOService.php
index d4f84ebf2f37aabaefee22ac360f0b49de281788..be2c9f50794a6249e73cf708e5d23a39863640c0 100644
--- a/www/shib13/idp/SSOService.php
+++ b/www/shib13/idp/SSOService.php
@@ -123,11 +123,14 @@ if (!$session->isAuthenticated($authority) ) {
 	$authId = SimpleSAML_Utilities::generateID();
 	$session->setAuthnRequest('shib13', $authId, $requestcache);
 
-
-	$relaystate = SimpleSAML_Utilities::selfURLNoQuery() . '?RequestID=' . urlencode($authId);
-	$authurl = SimpleSAML_Utilities::addURLparameter('/' . $config->getBaseURL() . $idpmetadata['auth'], 
-		'RelayState=' . urlencode($relaystate));
-	SimpleSAML_Utilities::redirect($authurl);
+	$redirectTo = SimpleSAML_Utilities::selfURLNoQuery() . '?RequestID=' . urlencode($authId);
+	$authurl = '/' . $config->getBaseURL() . $idpmetadata['auth'];
+
+	SimpleSAML_Utilities::redirect($authurl, array(
+		'RelayState' => $redirectTo,
+		'AuthId' => $authId,
+		'protocol' => 'shib13',
+	));
 	
 	
 /*