Added index on temporary tables when updating cursors