corrected connection checking
now logs exceptions