fixed a broken query range