Use buffer-substring-no-properties instead.

Chassell hints that you may want to use buffer-substring-no-properties instead of buffer-substring. This is because buffer-substring copies the text properties into the string, while buffer-substring-no-properties does not.