Added support for handling truncated strings