added support for disconnection in the middle of the transaction