diff --git a/exercises/algebraq/parser.php b/exercises/algebraq/parser.php
index a7873c390d0f9dcc7906f2ed7e31d833eaa753eb..543cf990c4567aca5aa8cb1ccfe6fa9d8a4a1ca9 100644
--- a/exercises/algebraq/parser.php
+++ b/exercises/algebraq/parser.php
@@ -1627,6 +1627,7 @@ class qtype_algebra_parser {
                 // Check whether the precedding argument (if there is one) is a number or
                 // a variable. In either case this is a addition/subtraction operation so we continue
                 if($i>0 and (is_a($tree[$i-1],'qtype_algebra_parser_variable') or
+                             is_a($tree[$i-1],'qtype_algebra_parser_special') or
                              is_a($tree[$i-1],'qtype_algebra_parser_number') or
                              is_a($tree[$i-1],'qtype_algebra_parser_bracket'))) {
                     continue;
diff --git a/exercises/me_exercise.php b/exercises/me_exercise.php
index adda37bfba6561a757cde1f67ff1edc4f762325e..e88e153c8183b0750c639b2dfb98b503ffaced3f 100644
--- a/exercises/me_exercise.php
+++ b/exercises/me_exercise.php
@@ -50,7 +50,7 @@ class me_exercise extends Exercise
 
         $this->task['variables'] = [];
 
-        foreach ($request['var'] as $i => $var) {
+        foreach ($request['var'] ?: [] as $i => $var) {
             if (trim($var) != '') {
                 $this->task['variables'][] = [
                     'name' => trim($var),