Fix issues reported by Dory.