Fixed for loops for older c style