fixes empty query, refs #6957