diff --git a/modules/openid/www/consumer.php b/modules/openid/www/consumer.php
index 7dedf50b4759e7e01f2b955b7e0a6b3925c098d6..94ac5316ea39f03f0361444611ced8a49b53c460 100644
--- a/modules/openid/www/consumer.php
+++ b/modules/openid/www/consumer.php
@@ -7,7 +7,6 @@
 $oldErrLevel = error_reporting();
 error_reporting($oldErrLevel & ~E_STRICT);
 
-#require_once('../../_include.php');
 require_once('Auth/OpenID/SReg.php');
 require_once('Auth/OpenID/Server.php');
 require_once('Auth/OpenID/ServerRequest.php');
@@ -24,17 +23,17 @@ $state = SimpleSAML_Auth_State::loadState($_REQUEST['AuthState'], 'openid:state'
 $authState = $_REQUEST['AuthState'];
 $authSource = SimpleSAML_Auth_Source::getById($state['openid:AuthId']);
 if ($authSource === NULL) {
-	throw new SimpleSAML_Error_BadRequest('Invalid AuthId \'' . $state['feide:AuthId'] . '\' - not found.');
+	throw new SimpleSAML_Error_BadRequest('Invalid AuthId \'' . $state['openid:AuthId'] . '\' - not found.');
 }
 
 
 function displayError($message) {
-    $error = $message;
+	global $authState;
 
 	$config = SimpleSAML_Configuration::getInstance();
 	$t = new SimpleSAML_XHTML_Template($config, 'openid:consumer.php', 'openid');
-	$t->data['msg'] = $msg;
-	$t->data['error'] = $error;
+	$t->data['error'] = $message;
+	$t->data['AuthState'] = $authState;
 	$t->show();
 }
 
@@ -46,22 +45,6 @@ function getConsumer() {
 	return new Auth_OpenID_Consumer($store);
 }
 
-function getOpenIDURL() {
-    // Render a default page if we got a submission without an openid
-    // value.
-    if (empty($_GET['openid_url'])) {
-        $error = "Expected an OpenID URL.";
-
-		$config = SimpleSAML_Configuration::getInstance();
-		$t = new SimpleSAML_XHTML_Template($config, 'openid:consumer.php', 'openid');
-		$t->data['msg'] = $msg;
-		$t->data['error'] = $error;
-		$t->show();
-    }
-
-    return $_GET['openid_url'];
-}
-
 function getReturnTo() {
 	return SimpleSAML_Utilities::addURLparameter(SimpleSAML_Utilities::selfURL(), 
 		array('returned' => '1') 
@@ -76,7 +59,7 @@ function getTrustRoot() {
 function run_try_auth() {
     global $authSource;
 
-    $openid = getOpenIDURL();
+    $openid = $_GET['openid_url'];
     $consumer = getConsumer();
 
     // Begin the OpenID authentication process.
@@ -190,7 +173,7 @@ function run_finish_auth() {
 
 if (array_key_exists('returned', $_GET)) {
 	run_finish_auth();
-} elseif(array_key_exists('openid_url', $_GET)) {
+} elseif (!empty($_GET['openid_url'])) {
 	run_try_auth();
 } else {
 	$config = SimpleSAML_Configuration::getInstance();