fix typo in loop break condition