add a safety check around the string manipulation to allow things to break silently.