fix unusedindices query