Fix trailing spaces handling.