Fix some issues Duncan found in the previous commit.