fixing errors when topic query results are empty