added trailing whitespace check