reverting couple of $i++ conversions