added trim to the right place