fix bug with empty query result