[#2222] don't check the loop status variable outside the loop