fixed a stupid oversight in trimcurve. I think, THINK, that this is
finally finished (will remove debug stuff soon)