Fixes on data range queries