breaking loop if exception