Fix a typo, and also skip the loop if it's not needed