checking for results before sorting