diff --git a/modules/ldapstatus/www/index.php b/modules/ldapstatus/www/index.php
index c9e5aa5466b38779c828344bdce8fe46e447a0b4..318a9d7c62c21c68355f74e6c6fcb2a3c803cb09 100644
--- a/modules/ldapstatus/www/index.php
+++ b/modules/ldapstatus/www/index.php
@@ -31,7 +31,7 @@ function phpping($host, $port) {
 	$socket = @fsockopen($host, $port, $errno, $errstr, $timeout);
 	@fclose($socket);
 	if ($errno) {
-		return array(FALSE, $errno . ':' . $errstr);
+		return array(FALSE, $errno . ':' . $errstr . ' [' . $host . ':' . $port . ']');
 	} else {		
 		return array(TRUE,NULL);
 	}
@@ -68,6 +68,7 @@ foreach ($orgs AS $orgkey => $orgconfig) {
 	$urldef = explode(' ', $orgconfig['hostname']);
 	$url = parse_url($urldef[0]);
 	$port = 389;
+	if (!empty($url['scheme']) && $url['scheme'] === 'ldaps') $port = 636;
 	if (!empty($url['port'])) $port = $url['port'];
 	
 	SimpleSAML_Logger::debug('ldapstatus Url parse [' . $orgconfig['hostname'] . '] => [' . $url['host'] . ']:[' . $port . ']' );