Fix prompt string length calculation