Fixes everal connectivity bugs.