Fix up a number of issues pointed out by Craig.