Made networking safer; minor fixes