Reordering more operations in test-library-search to avoid clobbering index changes