fix empty query, fix order of weight