Fix truncation logic