fix trailing spaces stripping