Fix problem with spaces at the end of sentence