added connect handling