Also fixes that it tried to make substrings past the end of the source if we overran the source length.