small refactoring of NetworkUtil