improvements for StripTrailingWhitespace