Fixed bug for empty query