diff --git a/ldvspec/lofardata/views.py b/ldvspec/lofardata/views.py
index 74f7bd6db1ea9a499b9501c06fd96f687b7757ff..bf226ed4764ac77e46cc162795c912e7c9ccf618 100644
--- a/ldvspec/lofardata/views.py
+++ b/ldvspec/lofardata/views.py
@@ -74,7 +74,7 @@ def compute_inputs_histogram(inputs):
     max_size = inputs_sizes.max()
 
     n_distinct_sizes = numpy.unique(inputs_sizes).__len__()
-    n_bins = n_distinct_sizes if n_distinct_sizes < 100 else 100
+    n_bins = min(n_distinct_sizes, 100)
     counts, buckets = numpy.histogram(inputs_sizes, bins=n_bins, range=(min_size, max_size))
     formatted_bins = [format_size(bucket) % bucket for bucket in buckets]