Hack: Commit transaction only if it is active