fixing trim bug