remove leading and trailing whitespace in messsages