use correct loop