truncate function