Fixed reporting errors and empty results for queries