Fix inserts into the database