Fixed some small issues in trim.py.