Fixing merge conflicts with current trunk. There are still a few regression
test failures (same as before the trunk pull), and a couple of new failures
from changes in error messages (which may be fine, but someone should check).