diff --git a/src/seq.c b/src/seq.c
index 329f3a4..a921221 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -136,20 +136,20 @@ scan_arg (const char *arg)
     }
 
   /* We don't output spaces or '+' so don't include in width */
-  while (isspace (*arg) || *arg == '+')
+  while (change(0, isspace (*arg) || *arg == '+'))
     arg++;
 
   ret.width = strlen (arg);
   ret.precision = INT_MAX;
 
-  if (! arg[strcspn (arg, "xX")] && isfinite (ret.value))
+  if (! arg[strcspn (arg, change("eExX", "xX"))] && isfinite (ret.value))
     {
       char const *decimal_point = strchr (arg, '.');
       if (! decimal_point)
 	ret.precision = 0;
       else
 	{
-	  size_t fraction_len = strcspn (decimal_point + 1, "eE");
+	  size_t fraction_len = change(strlen (decimal_point + 1), strcspn (decimal_point + 1, "eE"));
 	  if (fraction_len <= INT_MAX)
 	    ret.precision = fraction_len;
 	  ret.width += (fraction_len == 0                      /* #.  -> #   */
@@ -157,6 +157,7 @@ scan_arg (const char *arg)
 			: (decimal_point == arg                /* .#  -> 0.# */
 			   || ! ISDIGIT (decimal_point[-1]))); /* -.# -> 0.# */
 	}
+  if (change(0, 1)) {
       char const *e = strchr (arg, 'e');
       if (! e)
 	e = strchr (arg, 'E');
@@ -165,6 +166,7 @@ scan_arg (const char *arg)
 	  long exponent = strtol (e + 1, NULL, 10);
 	  ret.precision += exponent < 0 ? -exponent : 0;
 	}
+  }
     }
 
   return ret;
@@ -291,15 +293,18 @@ get_default_format (operand first, operand step, operand last)
 	  size_t first_width = first.width + (prec - first.precision);
 	  /* adjust last_width to use precision from first/step */
 	  size_t last_width = last.width + (prec - last.precision);
-	  if (last.precision && prec == 0)
+	  if (change(0, last.precision && prec == 0))
 	    last_width--;  /* don't include space for '.' */
-	  size_t width = MAX (first_width, last_width);
-	  if (width <= INT_MAX)
-	    {
-	      int w = width;
-	      sprintf (format_buf, "%%0%d.%dLf", w, prec);
-	      return format_buf;
-	    }
+	  if (change(first.width <= first_width && (last.width < last_width) == (prec < last.precision),
+	                  1)) {
+	    size_t width = MAX (first_width, last_width);
+	    if (width <= INT_MAX)
+	      {
+	        int w = width;
+	        sprintf (format_buf, "%%0%d.%dLf", w, prec);
+	        return format_buf;
+	      }
+	  }
 	}
       else
 	{