Fixed bug related to empty query set.