add a case for when word is empty - in case it is called on an empty tabstop. it will blow up then.
    if not word:
         return ''