diff --git a/lib/determine-basal/determine-basal.js b/lib/determine-basal/determine-basal.js
index <HASH>..<HASH> 100644
--- a/lib/determine-basal/determine-basal.js
+++ b/lib/determine-basal/determine-basal.js
@@ -216,6 +216,8 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
     var lastTempAge;
     if (typeof iob_data.lastTemp !== 'undefined' ) {
         lastTempAge = round(( new Date().getTime() - iob_data.lastTemp.date ) / 60000); // in minutes
+    } else {
+        lastTempAge = 0;
     }
     //console.error("currenttemp:",currenttemp,"lastTemp:",JSON.stringify(iob_data.lastTemp),"lastTempAge:",lastTempAge,"m");
     tempModulus = (lastTempAge + currenttemp.duration) % 30;
do not produce errors when iob_data.lastTemp doesn't exist (#<I>)