FIxed queries during metadata index delete. Part of #2028.