fix: modify for loops
offered by @Kflash