Fix trim cutting off last non-whitespace character