Renamed SafeSubstring param and supporting logic

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