Fix various issues with the 'trim' module.