Modulated phases, memory effect and defect density waves in thiourea