some refactoings and fixes for zeroconf