#3238 patched for loop