diff --git a/kiss_and_db.py b/kiss_and_db.py
index b85fb8b..e9b9723 100644
--- a/kiss_and_db.py
+++ b/kiss_and_db.py
@@ -62,14 +62,15 @@ def main():
                 attrib_names = ', '.join('"%s"' % w for w in a.keys())
                 attrib_values = ", ".join("?" * len(a.keys()))
                 sql = "INSERT INTO frames ("+attrib_names+") VALUES ("+attrib_values+")"
-
+                conn.commit()
+                
                 try:
                     # Insert data
                     conn.execute(sql, list(a.values()))
 
                     # TODO update stations table here
                     # Original intent was to include the id from the frames table,
-                    # but that would mean making another conn.commit() (I think).
+                    # but that would mean making another query.
                     # It's not immediately needed, so I'm skipping it.
                     # Build query
                     # "from" is wrappedin [] because it is a reserved word and using '' doesn't work.
@@ -83,11 +84,10 @@ def main():
                         print(query3)
                         # Insert/update data
                         conn.execute(query3)
+                        conn.commit()
                     except:
                         print("Stations table couldn't be updated.")
 
-                    conn.commit()
-
                     # TODO remove packets that are older ('created') than a limit set in config.ini
                     # "5 minutes" also works
                     #conn.execute("DELETE FROM frames WHERE created < DATETIME('now', '"+config['Settings']['keep_time']+"')")