loopConter variable declaration fixed