Renamed SafeSubstring param and supporting logic

SafeSubstring was passing "length" as "startIndex" incorrectly.