three small bug fixes

These are all 1-2 line changes. 6b77e8358ccbfe261910205ae16e4f32a1d1b46d looks larger but most of the diff is whitespace.