[Fixed] iteration with ranged query (see unit test changes for details