fix data races with in-mem iterator