a few small bug fixes

I've never used git before but I think this is how to get changes into the mainline