checking connection inside loop

@kamuslhv sorry, choosed wrong name from select box :)
@arvenil, just wanted to ask @daniel-nichter, but ok, will add changes there now.