atomically wrap the index