fix empty query bug