Fix range query