Fix bug when the query was empty.