remove trailing and blank spaces