Fix truncation bugs