Fix problems found by David.