diff --git a/MensaPlugin.class.php b/MensaPlugin.class.php
index bffa50215fda753c4da82f954dea5da7ae47becf..a6f635f8bad6b411d80b94e1926554e15112cf71 100755
--- a/MensaPlugin.class.php
+++ b/MensaPlugin.class.php
@@ -4,8 +4,6 @@
  * @author  David Siegfried <david.siegfried@uni-vechta.de>
  * @license GPL2 or any later version
  */
-
-
 StudipAutoloader::addAutoloadPath(__DIR__ . '/classes');
 
 class MensaPlugin extends StudIPPlugin implements PortalPlugin
@@ -13,7 +11,7 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
     public           $mapping;
     public           $order;
     protected static $injected = false;
-    
+
     /**
      * Constructor sets up the mapping table since PHP won't let you use
      * gettext's _-function in class declaration.
@@ -21,7 +19,7 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
     public function __construct()
     {
         parent::__construct();
-        
+
         $this->order = [
             'Hauptgericht',
             'Beilagen',
@@ -33,7 +31,7 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
             'Komplettmenü veget. Cafe Loung'
         ];
     }
-    
+
     /**
      * Add several information to object
      * @param Integer $date current date
@@ -51,11 +49,11 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
                 'name'    => 'mensa-widget-date',
                 'content' => $date ?: time(),
             ]);
-            
+
             self::$injected = true;
         }
     }
-    
+
     /**
      * Returns a template from this plugin with an optional layout (as long
      * as the request was not issued via AJAX).
@@ -73,7 +71,7 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
         $template->plugin = $this;
         return $template;
     }
-    
+
     /**
      * Displays the menu for a certain a specific date.
      *
@@ -82,16 +80,16 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
     public function menu_action($date = null, $direction = null)
     {
         $date = $this->timeshift($date ?: time(), $direction);
-        
+
         header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 30 * 60));
         header('Pragma: cache');
         header('Cache-Control: max-age=' . 30 * 60);
         header('X-Mensa-Widget-Title: ' . $this->getTitle($date));
         header('X-Mensa-Widget-Date: ' . $date);
-        
+
         echo $this->renderMenu($date);
     }
-    
+
     /**
      * Returns the widget/plugin name.
      *
@@ -101,7 +99,7 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
     {
         return _('Mensaplan');
     }
-    
+
     /**
      * Returns the title for the widget.
      *
@@ -112,7 +110,7 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
     {
         return $this->getPluginName() . ' - ' . strftime('%A %x', $date);
     }
-    
+
     /**
      * Renders the menu for a specific date.
      *
@@ -128,15 +126,15 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
         } catch (Exception $e) {
             $template          = $this->getTemplate('exception.php');
             $template->message = $e->getMessage();
-            
+
             if ($e->getCode() > 1) {
                 header('X-Mensa-Widget-Disable-Direction: true');
             }
         }
-        
+
         return $template->render();
     }
-    
+
     /**
      * Renders the whole menu widget for a specific date.
      *
@@ -150,7 +148,7 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
         $template->menu = $this->renderMenu($date);
         return $template->render();
     }
-    
+
     /**
      * Renders the portal widget.
      *
@@ -159,7 +157,7 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
     public function getPortalTemplate()
     {
         $options = Request::getArray('mensa-widget');
-        
+
         if (isset($options['date'])) {
             $date = $options['date'];
         } elseif (date('G') >= 15) {
@@ -167,13 +165,13 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
         } else {
             $date = strtotime('today midnight');
         }
-        
+
         $this->injectAssets($date);
-        
+
         $navigation = [];
-        
+
         $nav = new Navigation('');
-        $nav->setURL(URLHelper::getLink($GLOBALS['ABSOLUTE_URI_STUDIP'],
+        $nav->setURL(URLHelper::getURL($GLOBALS['ABSOLUTE_URI_STUDIP'],
             ['mensa-widget' => ['date' => strtotime('yesterday', $date)]]));
         $nav->setImage(
             Icon::create(
@@ -183,9 +181,9 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
             tooltip2(_('Einen Tag zurück')) + ['class' => 'mensa-widget-back']
         );
         $navigation[] = $nav;
-        
+
         $nav = new Navigation('');
-        $nav->setURL(URLHelper::getLink($GLOBALS['ABSOLUTE_URI_STUDIP'],
+        $nav->setURL(URLHelper::getURL($GLOBALS['ABSOLUTE_URI_STUDIP'],
             ['mensa-widget' => ['date' => strtotime('tomorrow', $date)]]));
         $nav->setImage(
             Icon::create(
@@ -195,14 +193,14 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
             tooltip2(_('Einen Tag weiter')) + ['class' => 'mensa-widget-forward']
         );
         $navigation[] = $nav;
-        
+
         $widget          = $GLOBALS['template_factory']->open('shared/string');
         $widget->content = $this->renderWidget($date);
         $widget->icons   = $navigation;
         $widget->title   = $this->getTitle($date);
         return $widget;
     }
-    
+
     /**
      * Get the diet for a specific date
      * @param null $date
@@ -213,7 +211,7 @@ class MensaPlugin extends StudIPPlugin implements PortalPlugin
         $timestamp = $date ?: strtotime('today midnight');
         return MensaHelper::getMenu($timestamp);
     }
-    
+
     /**
      * Calculate the prev / next date
      * @param        $date
diff --git a/classes/MensaCronjob.class.php b/classes/MensaCronjob.class.php
index 6dcfddd8d28b1a7a4335d24a90266e7fbaaf5858..4006b8b616452735adfea14cf5b89cf84c80212e 100755
--- a/classes/MensaCronjob.class.php
+++ b/classes/MensaCronjob.class.php
@@ -7,47 +7,47 @@
 class MensaCronjob extends CronJob
 {
     private static $curl_timeout = 50;
-    
+
     public static function getName()
     {
         return _('Mensa-Cronjob');
     }
-    
+
     public static function getDescription()
     {
         return _('Lädt die Speisepläne für das Studentenwerk Osnabrück herunter');
     }
-    
+
     public function setUp()
     {
         PluginEngine::getPlugin('MensaPlugin');
     }
-    
+
     public function execute($last_result, $parameters = [])
     {
         $sourceFile = 'ftp://' . Config::get()->MENSA_FTP_SERVER . '/' . Config::get()->MENSA_FTP_FILE;
         $filename   = MensaHelper::getFilename();
         $curl       = curl_init();
-        
+
         curl_setopt($curl, CURLOPT_URL, $sourceFile);
         curl_setopt($curl, CURLOPT_USERPWD, Config::get()->MENSA_FTP_USER . ':' . Config::get()->MENSA_FTP_PASS);
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
         curl_setopt($curl, CURLOPT_TIMEOUT, self::$curl_timeout);
-        
+
         $result = curl_exec($curl);
-        
+
         if ($result) {
             echo "Der Import der Mensa-Datei war erfolgreich!\n";
         } else {
             echo "Der Import der Mensa-Datei war nicht erfolgreich\n";
         }
-        
+
         curl_close($curl);
-        
+
         if ($result !== false) {
             file_put_contents($filename, $result);
         }
-        
+
         if (!isset($_SERVER)) {
             chown($filename, 'www-data');
             chgrp($filename, 'www-data');
diff --git a/classes/MensaHelper.class.php b/classes/MensaHelper.class.php
index 16fbc58d180decfc1933a6fda961c6c5385941ca..6db6fe89db60ac05864bda36ce64ba0fe8fc590f 100755
--- a/classes/MensaHelper.class.php
+++ b/classes/MensaHelper.class.php
@@ -10,23 +10,23 @@ class MensaHelper
     public static function getMenu($timestamp = null)
     {
         $file = self::getFilename();
-        
+
         if (!file_exists($file)) {
             return [];
         }
-        
+
         $content = array_map(function ($string) {
             $string = utf8_encode($string);
             return str_getcsv($string, "\t");
         }, file($file));
-        
+
         $data     = [];
         $language = substr($_SESSION['_language'], 0, 2);
-        
+
         $headLine = $content[0];
         unset($content[0]);
         $pos = array_change_key_case(array_flip($headLine));
-        
+
         foreach ($content as $row) {
             if ($row[$pos['mensa']] == Config::get()->MENSA_LOCATION) {
                 $date  = strtotime($row[$pos['datum']]);
@@ -50,20 +50,20 @@ class MensaHelper
                 $data[$date][$order][] = $item;
             }
         }
-     
+
         return $data[$timestamp];
     }
-    
+
     public static function getFilename()
     {
         return $GLOBALS['TMP_PATH'] . '/mensa.txt';
     }
-    
+
     public static function replace($string)
     {
         $patterns     = ['/\(/', '/\)/'];
         $replacements = ['<sup>', '</sup>'];
-        
+
         return preg_replace($patterns, $replacements, htmlReady($string));
     }
 }
\ No newline at end of file
diff --git a/migrations/01_add_cronjob.php b/migrations/01_add_cronjob.php
index 8e160e000815f49d6abe08de013131a411f2fe2e..d10836ecfcfc96fe27df508e8a85a03013f9e700 100755
--- a/migrations/01_add_cronjob.php
+++ b/migrations/01_add_cronjob.php
@@ -11,25 +11,24 @@ class AddCronjob extends Migration
     {
         return 'Fügt den Cronjob zum Herunterladen der Speisepläne hinzu.';
     }
-    
+
     public function up()
     {
-        $task_id  = CronjobScheduler::registerTask($this->getCronjobFilename());
-        $schedule = CronjobScheduler::schedulePeriodic($task_id, 0, 0, 2);
-        
-        $schedule->active = true;
-        $schedule->store();
+
+        if (CronjobTask::countByClass(MensaCronjob::class)) {
+            $task_id = CronjobScheduler::registerTask(new MensaCronjob());
+            $schedule = CronjobScheduler::schedulePeriodic($task_id, 0, 0, 2);
+            $schedule->active = true;
+            $schedule->store();
+        }
     }
-    
+
     public function down()
     {
-        $task = reset(CronjobTask::findByClass('MensaCronjob'));
-        CronjobScheduler::unregisterTask($task->task_id);
-    }
-    
-    private function getCronjobFilename()
-    {
-        return str_replace($GLOBALS['STUDIP_BASE_PATH'] . '/', '',
-            realpath(__DIR__ . '/../classes/MensaCronjob.class.php'));
+        $task = CronjobTask::findOneBySQL(MensaCronjob::class);
+        if($task) {
+            CronjobScheduler::unregisterTask($task->task_id);
+        }
     }
+
 }
\ No newline at end of file
diff --git a/migrations/03_add_config_location.php b/migrations/03_add_config_location.php
index 5cbb2cfcb7eaef6cac935339507a67cf2ee998d4..179e02057444c7b22d96687d7d6f0f67065bb363 100755
--- a/migrations/03_add_config_location.php
+++ b/migrations/03_add_config_location.php
@@ -11,7 +11,7 @@ class AddConfigLocation extends Migration
     {
         return 'Lagert den Standort in die globale Konfiguration aus';
     }
-    
+
     public function up()
     {
         if (!Config::get()->MENSA_LOCATION) {
@@ -25,10 +25,10 @@ class AddConfigLocation extends Migration
             ]);
         }
     }
-    
+
     public function down()
     {
         Config::get()->delete('MENSA_LOCATION');
     }
-    
+
 }
\ No newline at end of file
diff --git a/plugin.manifest b/plugin.manifest
index 367a4acd41d6fa98286887e4f70ddfa7141b3b81..0b7c3385dac204b174fbe1119601ebfc71b1410e 100755
--- a/plugin.manifest
+++ b/plugin.manifest
@@ -1,8 +1,9 @@
 pluginclassname=MensaPlugin
 pluginname=Mensa
 origin=Vec
-version=2.1
+version=2.2
 studipMinVersion=4.0
+studipMaxVersion=5.9.99
 description=Zeigt den Mensaplan als Widget aber auch als Gesamtübersicht an
 displayname = Studentenwerk OS Mensaplan
 descriptionshort = Studentenwerk OS Mensaplandarstellung