Changed location of conn.commit()