Compute index if missing