Fix calculation to cut off words at end