MRQL-33: Fix various bugs in iteration queries