Changed tests to run inside transactions when needed