slightly better error handling around connections