fix bug when no query is supplied