Fix mysql transaction