diff --git a/ippisite/ippidb/views.py b/ippisite/ippidb/views.py
index e4f6363b293a9f158cf5d52c6c586a5f11672a66..6ae892102921ae96ee47225b340e1fc09996075e 100644
--- a/ippisite/ippidb/views.py
+++ b/ippisite/ippidb/views.py
@@ -146,8 +146,8 @@ class IppiWizard(LoginRequiredMixin, NamedUrlSessionWizardView):
 
 def process_cutoff_value(name, context, request, cutoff_dir='l'):
     c = context['compounds']
-    context[name+'_max'] = str(int(math.ceil(float(c.aggregate(Max(name))[name + '__max']))))
-    context[name+'_min'] = str(int(math.floor(float(c.aggregate(Min(name))[name + '__min']))))
+    context[name+'_max'] = str(int(math.ceil(float(c.aggregate(Max(name))[name + '__max'] or 0))))
+    context[name+'_min'] = str(int(math.floor(float(c.aggregate(Min(name))[name + '__min'] or 0))))
     if request.GET.get(name):
         context[name] = request.GET.get(name)
         filter_dict = {name + '__' + cutoff_dir + 'te': context[name]}