in some cases loopBreak not breaking loop