Updating optimistic concurrency tests to use transactions.
Also fixing bugs found in the process.