fix the query of range