Fix issues reported by Aaron Kaplan