corrected int initilization in for loop