ensure the substrToLastWord will not accidentally remove last word