Fixed a few problems reported by Ryan.