Cap off substring, fixes #420