added length truncation to ts utility