handle trailing whitespace