added callback for connect to handle connection errors easier