remove trailing spaces from input fields