Fix error in transaction handling