Fixes to checkconnection code to address code review.