wrongly placed break in wile loop