diff --git a/lib/SimpleSAML/Locale/Language.php b/lib/SimpleSAML/Locale/Language.php
index b8be4a30e2e2d4acfd333c4676cb8d829ef4b5f2..3f0387fbdd4756d7e23069e4ee057aaf9d5c8d8e 100644
--- a/lib/SimpleSAML/Locale/Language.php
+++ b/lib/SimpleSAML/Locale/Language.php
@@ -117,8 +117,7 @@ class Language
         }
 
         // run custom getLanguage function if defined
-        if (isset($this->customFunction)) {
-            assert('is_callable($customFunction)');
+        if (isset($this->customFunction) && is_callable($this->customFunction)) {
             $customLanguage = call_user_func($this->customFunction, $this);
             if ($customLanguage !== null && $customLanguage !== false) {
                 return $customLanguage;
@@ -216,12 +215,10 @@ class Language
      */
     public function getLanguageList()
     {
-        $thisLang = $this->getLanguage();
-        $lang = array();
-        foreach ($this->availableLanguages as $nl) {
-            $lang[$nl] = ($nl == $thisLang);
-        }
-        return $lang;
+        $current = $this->getLanguage();
+        $list = array_fill_keys($this->availableLanguages, false);
+        $list[$current] = true;
+        return $list;
     }
 
 
@@ -232,11 +229,7 @@ class Language
      */
     public function isLanguageRTL()
     {
-        $thisLang = $this->getLanguage();
-        if (in_array($thisLang, $this->rtlLanguages)) {
-            return true;
-        }
-        return false;
+        return in_array($this->getLanguage(), $this->rtlLanguages);
     }