diff --git a/sickbeard/databases/cache_db.py b/sickbeard/databases/cache_db.py
index 8cfe5a4167c00eea6387823db1a1188d28b0e3b9..9734be453c48afe4e03f25d0a6028bfb60a447b6 100644
--- a/sickbeard/databases/cache_db.py
+++ b/sickbeard/databases/cache_db.py
@@ -24,15 +24,14 @@ class InitialSchema(db.SchemaUpgrade):
         return self.hasTable("db_version")
 
     def execute(self):
-
         queries = [
-            ("CREATE TABLE db_version (db_version INTEGER);",),
             ("CREATE TABLE lastUpdate (provider TEXT, time NUMERIC);",),
             ("CREATE TABLE lastSearch (provider TEXT, time NUMERIC);",),
             ("CREATE TABLE scene_exceptions (exception_id INTEGER PRIMARY KEY, indexer_id INTEGER KEY, show_name TEXT, season NUMERIC DEFAULT -1, custom NUMERIC DEFAULT 0);",),
             ("CREATE TABLE scene_names (indexer_id INTEGER, name TEXT);",),
             ("CREATE TABLE network_timezones (network_name TEXT PRIMARY KEY, timezone TEXT);",),
             ("CREATE TABLE scene_exceptions_refresh (list TEXT PRIMARY KEY, last_refreshed INTEGER);",),
+            ("CREATE TABLE db_version (db_version INTEGER);",),
             ("INSERT INTO db_version(db_version) VALUES (1);",),
         ]
         for query in queries:
@@ -48,14 +47,14 @@ class AddSceneExceptions(InitialSchema):
 
     def execute(self):
         self.connection.action(
-            "CREATE TABLE scene_exceptions (exception_id INTEGER PRIMARY KEY, indexer_id INTEGER KEY, show_name TEXT)")
+            "CREATE TABLE scene_exceptions (exception_id INTEGER PRIMARY KEY, indexer_id INTEGER KEY, show_name TEXT);")
 
 class AddSceneNameCache(AddSceneExceptions):
     def test(self):
         return self.hasTable("scene_names")
 
     def execute(self):
-        self.connection.action("CREATE TABLE scene_names (indexer_id INTEGER, name TEXT)")
+        self.connection.action("CREATE TABLE scene_names (indexer_id INTEGER, name TEXT);")
 
 
 class AddNetworkTimezones(AddSceneNameCache):
@@ -63,16 +62,16 @@ class AddNetworkTimezones(AddSceneNameCache):
         return self.hasTable("network_timezones")
 
     def execute(self):
-        self.connection.action("CREATE TABLE network_timezones (network_name TEXT PRIMARY KEY, timezone TEXT)")
+        self.connection.action("CREATE TABLE network_timezones (network_name TEXT PRIMARY KEY, timezone TEXT);")
 
 class AddLastSearch(AddNetworkTimezones):
     def test(self):
         return self.hasTable("lastSearch")
 
     def execute(self):
-        self.connection.action("CREATE TABLE lastSearch (provider TEXT, time NUMERIC)")
+        self.connection.action("CREATE TABLE lastSearch (provider TEXT, time NUMERIC);")
 
-class AddSceneExceptionsSeasons(AddSceneNameCache):
+class AddSceneExceptionsSeasons(AddLastSearch):
     def test(self):
         return self.hasColumn("scene_exceptions", "season")
 
@@ -92,4 +91,4 @@ class AddSceneExceptionsRefresh(AddSceneExceptionsCustom):
 
     def execute(self):
         self.connection.action(
-            "CREATE TABLE scene_exceptions_refresh (list TEXT PRIMARY KEY, last_refreshed INTEGER)")
+            "CREATE TABLE scene_exceptions_refresh (list TEXT PRIMARY KEY, last_refreshed INTEGER);")
diff --git a/sickbeard/network_timezones.py b/sickbeard/network_timezones.py
index 6a1805760f6be3d32c6a5ace9f87a01355ecc32e..b01d9a3a072bdb1a6ab3f4c6e7c3eafba81cea68 100644
--- a/sickbeard/network_timezones.py
+++ b/sickbeard/network_timezones.py
@@ -171,22 +171,22 @@ def update_network_dict():
 
     my_db = db.DBConnection('cache.db')
 
-    network_list = dict(my_db.select('SELECT * FROM network_timezones'))
+    network_list = dict(my_db.select('SELECT * FROM network_timezones;'))
 
     queries = []
     for network, timezone in d.iteritems():
         existing = network_list.has_key(network)
         if not existing:
-            queries.append(['INSERT OR IGNORE INTO network_timezones VALUES (?,?)', [network, timezone]])
+            queries.append(['INSERT OR IGNORE INTO network_timezones VALUES (?,?);', [network, timezone]])
         elif network_list[network] is not timezone:
-            queries.append(['UPDATE OR IGNORE network_timezones SET timezone = ? WHERE network_name = ?', [timezone, network]])
+            queries.append(['UPDATE OR IGNORE network_timezones SET timezone = ? WHERE network_name = ?;', [timezone, network]])
 
         if existing:
             del network_list[network]
 
     if network_list:
         purged = list(x for x in network_list)
-        queries.append(['DELETE FROM network_timezones WHERE network_name IN (%s)' % ','.join(['?'] * len(purged)), purged])
+        queries.append(['DELETE FROM network_timezones WHERE network_name IN (%s);' % ','.join(['?'] * len(purged)), purged])
 
     if queries:
         my_db.mass_action(queries)
@@ -197,10 +197,10 @@ def update_network_dict():
 def load_network_dict():
     try:
         my_db = db.DBConnection('cache.db')
-        cur_network_list = my_db.select('SELECT * FROM network_timezones')
+        cur_network_list = my_db.select('SELECT * FROM network_timezones;')
         if cur_network_list is None or len(cur_network_list) < 1:
             update_network_dict()
-            cur_network_list = my_db.select('SELECT * FROM network_timezones')
+            cur_network_list = my_db.select('SELECT * FROM network_timezones;')
         d = dict(cur_network_list)
     except:
         d = {}
diff --git a/sickbeard/scene_exceptions.py b/sickbeard/scene_exceptions.py
index ae1e920d0b63e122c4633d0b9e54b1d37c18e805..063ab210671150c89f3c0aad6845de97674f4e28 100644
--- a/sickbeard/scene_exceptions.py
+++ b/sickbeard/scene_exceptions.py
@@ -223,30 +223,22 @@ def retrieve_exceptions():
         else:
             exception_dict[anidb_ex] = anidb_exception_dict[anidb_ex]
 
-    changed_exceptions = False
-
-    # write all the exceptions we got off the net into the database
+    queries = []
     myDB = db.DBConnection('cache.db')
     for cur_indexer_id in exception_dict:
-
-        # get a list of the existing exceptions for this ID
-        existing_exceptions = [x["show_name"] for x in
-                               myDB.select("SELECT * FROM scene_exceptions WHERE indexer_id = ?", [cur_indexer_id])]
-
+        sql_ex = myDB.select("SELECT * FROM scene_exceptions WHERE indexer_id = ?;", [cur_indexer_id])
+        existing_exceptions = [x["show_name"] for x in sql_ex]
         if not cur_indexer_id in exception_dict:
             continue
 
         for cur_exception_dict in exception_dict[cur_indexer_id]:
-            cur_exception, curSeason = cur_exception_dict.items()[0]
-
-            # if this exception isn't already in the DB then add it
-            if cur_exception not in existing_exceptions:
-                myDB.action("INSERT INTO scene_exceptions (indexer_id, show_name, season) VALUES (?,?,?)",
-                            [cur_indexer_id, cur_exception, curSeason])
-                changed_exceptions = True
-
-    # since this could invalidate the results of the cache we clear it out after updating
-    if changed_exceptions:
+            for ex in cur_exception_dict.iteritems():
+                cur_exception, curSeason = ex
+                if cur_exception not in existing_exceptions:
+                    queries.append(["INSERT OR IGNORE INTO scene_exceptions (indexer_id, show_name, season) VALUES (?,?,?);",
+                            [cur_indexer_id, cur_exception, curSeason]])
+    if queries:
+        myDB.mass_action(queries)
         logger.log(u"Updated scene exceptions", logger.DEBUG)
     else:
         logger.log(u"No scene exceptions update needed", logger.DEBUG)
@@ -316,7 +308,7 @@ def _xem_exceptions_fetcher():
             if parsedJSON['result'] == 'failure':
                 continue
 
-            for indexerid, names in parsedJSON['data'].items():
+            for indexerid, names in parsedJSON['data'].iteritems():
                 try:
                     xem_exception_dict[int(indexerid)] = names
                 except Exception as e: