better fix for trailing spaces issue