fix trim bug