input/vlm: narrow scope of iteration variables