diff --git a/xfel_calibrate/calibrate.py b/xfel_calibrate/calibrate.py
index ee22e2fbd7ebf7adddd6e861cb1e3d75df432be3..95207dbb5aded860ad8e689a3662096a6e4a785d 100755
--- a/xfel_calibrate/calibrate.py
+++ b/xfel_calibrate/calibrate.py
@@ -478,10 +478,12 @@ def flatten_list(l):
     :return: Same string or string with first and last entry of a list
     """
     if isinstance(l, list):
-        if len(l)>1:
+        if len(l) > 1:
             return '{}-{}'.format(l[0], l[-1])
-        else:
+        elif len(l) == 1:
             return '{}'.format(l[0])
+        else:
+            return '{}'
     else:
         return str(l)