add connect error handling