Don't submit empty queries. Fixes #563