Fix bug when empty query string passed