Effect of structural features in NdFeb-based magnets on the demagnetization process