remove trailing spaces on load and write