LOOPCOUNTER variable fixes

Variable init incorrect

Maths do not work.