remove trailing spaces before save