diff --git a/src/xfel_calibrate/calibrate.py b/src/xfel_calibrate/calibrate.py
index 3b67a0e624b583f63b6b69ac8ec10b6f0b35311f..26e45f0fe1e7e439f85a166bb92c8e97df86a27b 100755
--- a/src/xfel_calibrate/calibrate.py
+++ b/src/xfel_calibrate/calibrate.py
@@ -57,6 +57,8 @@ def extract_title_author(nb):
     """
 
     first_md = first_markdown_cell(nb)
+    if first_md is None:
+        return None, None
     source = first_md["source"]
     title = re.findall(r'#+\s*(.*)\s*#+', source)
     author = re.findall(
@@ -375,7 +377,9 @@ def prepare_job(
     params = parameter_values(params, cluster_profile=cluster_profile)
     new_nb = replace_definitions(nb, params, execute=False, lang='python')
     if not show_title:
-        first_markdown_cell(new_nb).source = ''
+        title_cell = first_markdown_cell(new_nb)
+        if title_cell is not None:
+            title_cell.source = ''
     set_figure_format(new_nb, args["vector_figs"])
     new_name = f"{nb_path.stem}__{cparm}__{suffix}.ipynb"
 
diff --git a/src/xfel_calibrate/nb_args.py b/src/xfel_calibrate/nb_args.py
index 3dc5280b922b3f52bea0a0f39c1cb1f448c1bfc7..511223ed69462c5cab82ad87025d9a848481c9b6 100644
--- a/src/xfel_calibrate/nb_args.py
+++ b/src/xfel_calibrate/nb_args.py
@@ -282,7 +282,7 @@ def make_epilog(nb, caltype=None):
     """
     msg = ""
     header_cell = first_markdown_cell(nb)
-    lines = header_cell.source.split("\n")
+    lines = header_cell.source.split("\n") if header_cell is not None else ['']
     if caltype:
         msg += "{:<15}  {}".format(caltype, lines[0]) + "\n"
     else: