break

break isn't clearing chk, your code is changing it. break exits the innermost enclosing loop or switch statement with immediate effect.