diff --git a/notebooks/LPD/LPDChar_Darks_NBC.ipynb b/notebooks/LPD/LPDChar_Darks_NBC.ipynb
index 68258048916fde65c3f1800c0aba3367173d5b6f..5bec878b3381961f1bf9502bab6efd8173cd921b 100644
--- a/notebooks/LPD/LPDChar_Darks_NBC.ipynb
+++ b/notebooks/LPD/LPDChar_Darks_NBC.ipynb
@@ -238,8 +238,8 @@
     "    first = infile[f\"{bpath}/first\"][()]\n",
     "    valid = count != 0\n",
     "    count, first = count[valid], first[valid]\n",
-    "    first_image = first[skip_first_ntrains]\n",
-    "    last_image = first_image + np.sum(count[skip_first_ntrains:skip_first_ntrains+ntrains])\n",
+    "    first_image = int(first[skip_first_ntrains] if first.shape[0] > skip_first_ntrains else 0)\n",
+    "    last_image = int(first_image + np.sum(count[skip_first_ntrains:skip_first_ntrains+ntrains]))\n",
     "\n",
     "    im = np.array(infile[\"/INSTRUMENT/FXE_DET_LPD1M-1/DET/{}CH0:xtdf/image/data\".format(\n",
     "        channel)][first_image:last_image, ...])\n",