improve truncate_smart