fix end_transaction()