Evidence of a relation between structural defects and phase transitions in NASICON type compounds