small refactoring and fixed delay when starting network