remove illegal trailing whitespace