diff --git a/lib/config-template.php b/lib/config-template.php
index f2cd131bd6778bf06447bbc5bc4e7f2d60a24520..4d6e38b6771647d2feb85f240048e2b3b66bcb98 100644
--- a/lib/config-template.php
+++ b/lib/config-template.php
@@ -18,7 +18,7 @@ define('DB_DATABASE','edugain');
 
 // Validator locations
 define('VALIDATOR_REQ','http://localhost:5000/validate?r=');
-define('VALIDATOR_TMP', '/srv/edugain.config/mds/tmp');
+define('VALIDATOR_TMP', '/srv/edugain.tmp/validator');
 
 // details of simpleSAMLphp for management login
 
diff --git a/lib/validatorClass.php b/lib/validatorClass.php
index b9bc1ddb2556c155adf8a5001f4b4276e7043c4d..0abc2c35cb2375685b7dce0056835b48a2f5c20e 100644
--- a/lib/validatorClass.php
+++ b/lib/validatorClass.php
@@ -121,7 +121,7 @@ class Validator {
                     if (!isset($_REQUEST['entities']))
                         $this->params['validate'] = 1;
                 }
-                if (isset($_REQUEST['xmlout']))
+                if (isset($_REQUEST['xmlout']) || (!empty($_REQUEST['format']) && $_REQUEST['format'] == 'xml') )
                     $this->params['xmlout'] = $this->params['auto'] = $this->params['validate'] = 1;
                 if (!isset($_REQUEST['oneentity']))
                     $this->params['entities'] = 1;
diff --git a/web/validator-check-logos.php b/web/validator-check-logos.php
index 89c2c13ef13e80bb9ec7c062dc7ccac0c3148b07..058323755f106543ef5a0fde0c508bc44aa9522f 100644
--- a/web/validator-check-logos.php
+++ b/web/validator-check-logos.php
@@ -67,7 +67,12 @@ foreach ($_POST as $k=>$v) {
          fclose($fp);
          if ($suffix == 'svg') {
            $f = fopen($fileName, 'r');
-           $imageData = fread($f, filesize($fileName));
+           if ($f && filesize($fileName) > 0) {
+             $imageData = fread($f, filesize($fileName));
+           } else {
+             $imageData = "";
+             $result[] =  'ERROR: Could not download logo';
+           }
          }
        } else {
          $fileName = '/tmp/testlogo'.bin2hex(openssl_random_pseudo_bytes(10));
@@ -99,15 +104,30 @@ foreach ($_POST as $k=>$v) {
        } else {
          $result[] = 'OKLOCAL';
        }
+       $skipcheck = false;
        if ($suffix == 'svg') {
-         $xmlget = simplexml_load_string($imageData);
-         $xmlattributes = $xmlget->attributes();
+         try {
+           $xmlget = simplexml_load_string($imageData);
+           if ($xmlget !== false) {
+             $xmlattributes = $xmlget->attributes();
+           } else {
+             $result[] = "ERROR: not SVG image";
+             $xmlattributes = NULL;
+             $skipcheck = true;
+           }
+         } catch (Exception $e) {
+           $result[] = "ERROR: not SVG image";
+           $skipcheck = true;
+         }
+         if ($xmlattributes) {
          $width = $xmlattributes->width;
          $height = $xmlattributes->height;
-         $size = array($width, $hight);
+         $size = array($width, $height);
+         }
        } else {
          $size = getimagesize($fileName);
        }
+       if (!$skipcheck) {
        if ($size === false && !preg_match('/\.svg$/i', $limg)) {
          $result[] = "ERROR: The downloaded logo does not seem to be a PNG, JPG, GIF, SVG or a generally accepted image file format. Therefore, it most probably will not be displayed by web browsers.";
        }
@@ -127,6 +147,7 @@ foreach ($_POST as $k=>$v) {
        if ($width && $height && isset($size[0]) && isset($size[1]) && round(10*$width/$height) != round(10*$size[0]/$size[1])) {
          $result[] = "WARNING: Mismatching proportions (".$width.'px:'.$height."px=".round($width/$height,1)." in metadata vs ".$size[0].'px:'.$size[1].'px='.round($size[0]/$size[1],1)." actual). The logo will be displayed distorted by Discovery Services and Service Providers.";
        }
+       }
        $res = array('result' => '', 'url' => '');
        if ($remote != '') {
          $res['url'] = $remote;