trim.pbs: bug fixes