Modified if block to default to instances.count() on None value of num_results