added flag in the actionhandler of the connect button