diff --git a/webfront.py b/webfront.py
index f374ff8..7b0ce9a 100755
--- a/webfront.py
+++ b/webfront.py
@@ -297,7 +297,7 @@ class ImgHandler(tornado.web.RequestHandler):
         
         if client_bgset is not "":
             bglist = []
-            for ls in os.listdir(client_bgset):
+            for ls in os.listdir(client_bgset).sort():
                 if not ls.startswith("."):
                     bglist.append(client_bgset + "/" + ls)
             bg = Image.open(bglist[r.hasharray[3] % len(bglist)])