added connection exception handling