diff --git a/src/@dseries/subsasgn.m b/src/@dseries/subsasgn.m
index 89c1da78fed12a9520c8a2c6480b3001245e4f50..50f50385bb0b3764fe72b28b358433c0b6d1138f 100644
--- a/src/@dseries/subsasgn.m
+++ b/src/@dseries/subsasgn.m
@@ -48,8 +48,8 @@ switch length(S)
                 error('dseries::subsasgn: (MATLAB/Octave''s regular expressions) Check opening and closing square brackets!')
             end
             % Loops and regular expressions are not compatible
-            if length(idArobase) && length(idBracket.open)
-                error(['dseries::subsasgn: You cannot use implicit loops and regular expressions in the same rule!'])
+            if ~isempty(idArobase) && ~isempty(idBracket.open)
+                error('dseries::subsasgn: You cannot use implicit loops and regular expressions in the same rule!')
             end
             if ~isempty(idArobase)
                 elements = build_list_of_variables_with_loops({}, idArobase, element, {});
@@ -76,7 +76,7 @@ switch length(S)
                     id = find(strcmp(S(1).subs{i},A.name));
                     if isempty(id)
                         % Add a new variable a change its name.
-                        B.name(i) = {S(1).subs{i}};
+                        B.name(i) = S(1).subs(i);
                         B.tex(i) = {name2tex(S(1).subs{i})};
                     else
                         % Rename variable and change its content.
@@ -152,7 +152,7 @@ switch length(S)
                 A.tex = name2tex(A.name);
                 if isempty(A.dates)
                     if isempty(A.dates.freq)
-                        init = dates('1Y')
+                        init = dates('1Y');
                     else
                         init = dates(A.dates.freq, 1, 1);
                     end