diff --git a/stats.py b/stats.py
index 098f683e0b5e74fd9588ff44b73dee9c1a83696b..6023782053610015081d2c51b3b002848983711b 100644
--- a/stats.py
+++ b/stats.py
@@ -48,11 +48,11 @@ def stats_generic(req, param=None):
 	lastx = 0
 	for row in rows:
 		for key, val in row.items():
-			if req == 'live_views' and key == 'x' and lastx != int(val)-1:
-				for i in range(lastx, int(val)-1):
-					res['x'].append(i)
-					res['y'].append(0)
-			if key == 'x':
+			if req == 'live_views' and key == 'x':
+				if lastx != int(val)-1:
+					for i in range(lastx, int(val)-1):
+						res['x'].append(i)
+						res['y'].append(0)
 				lastx = int(val)
 			if key not in res:
 				res[key] = []