Drive-by switch fix.
Updated to support restoring transactions.