The code here is: for(my $i = 0; $i < $count; $i++) { if($calc{'X'}) { # check if we have to increase the new value. $newinnerloop1 += 1; if ($newinnerloop1 >= $pattern->{every1}) { $newinnerloop1 = 0; $newlastvalue1 += $pattern->{add1}; } # reset counter if needed. $newlastvalue1 = $pattern->{setto1} if ($newlastvalue1 > $pattern->{whenmorethan1}); } And above: $newinnerloop1 = $subscription->{innerloop1} || 0; I believe this is caused by subscription_numberpatterns.every1 being NULL. The default in the database is NULL, but I haven't tested if this can be set manually from the GUI yet.