diff --git a/src/backupninja.in b/src/backupninja.in
index d6a1045341d3b41b59bbccc7a00947314b3c0a5b..6da72375017eb5c1f93804a35de1545688259e33 100755
--- a/src/backupninja.in
+++ b/src/backupninja.in
@@ -186,7 +186,7 @@ function tolower() {
 
 # simple to integer function
 function toint() {
-   echo "$1" | tr -d '[:alpha:]'
+   echo "$1" | @SED@ 's/[^0-9]//g;s/^0\+//'
 }
 
 #
@@ -202,7 +202,7 @@ function toint() {
 # we grab the current time once, since processing
 # all the configs might take more than an hour.
 nowtime=`LC_ALL=C date +%H`
-nowday=`LC_ALL=C date +%d`
+nowday=`LC_ALL=C date +%-d`
 nowdayofweek=`LC_ALL=C date +%A`
 nowdayofweek=`tolower "$nowdayofweek"`