fix for loop for jshint complaint