Fix for query to ignore null indexes.