A few small bug fixes

If you find these changes acceptable, please merge them in.  Thank you.