Added null checks to the string utils