Fix bug with start-of-word checking