Merge pull request #3058 from vlakoff/word_wrap

Fixes in word_wrap() functions