fix bug trim_to_size()