Fix bug with trimming, add better message