Improved transaction handling for indexing.