fixing bad loop: