fix trim functions