fix a bug when trim is enabled.