fix crash on empty query