CGE: Add safeguard in expand()
CGE: Add safeguards in text manager