diff --git a/xfel_calibrate/calibrate.py b/xfel_calibrate/calibrate.py
index 8e23c3387afb9699e4fcca30495d952dbeed66ae..eed16c2769b840f7086bd8d88af870bd7b5e5496 100755
--- a/xfel_calibrate/calibrate.py
+++ b/xfel_calibrate/calibrate.py
@@ -482,10 +482,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)